user: How do I use Event(bpy_struct) in Blender? Include parameters, examples, warnings and best practices.

assistant: # Event(bpy_struct)

base class — [`bpy_struct`](bpy.types.bpy_struct.html#bpy.types.bpy_struct "bpy.types.bpy_struct")

*class* bpy.types.Event(*bpy_struct*)
:   Window Manager Event

    alt
    :   True when the Alt/Option key is held

        Type:
        :   boolean, default False, (readonly)

    ascii
    :   Single ASCII character for this event

        Type:
        :   string, default “”, (readonly, never None)

    ctrl
    :   True when the Ctrl key is held

        Type:
        :   boolean, default False, (readonly)

    direction
    :   The direction (only applies to drag events)

        Type:
        :   enum in [Event Direction Items](bpy_types_enum_items/event_direction_items.html#rna-enum-event-direction-items), default `'ANY'`, (readonly)

    hyper
    :   True when the Hyper key is held

        Type:
        :   boolean, default False, (readonly)

    is_consecutive
    :   Part of a trackpad or NDOF motion, interrupted by cursor motion, button or key press events

        Type:
        :   boolean, default False, (readonly)

    is_mouse_absolute
    :   The last motion event was an absolute input

        Type:
        :   boolean, default False, (readonly)

    is_repeat
    :   The event is generated by holding a key down

        Type:
        :   boolean, default False, (readonly)

    is_tablet
    :   The event has tablet data

        Type:
        :   boolean, default False, (readonly)

    mouse_prev_press_x
    :   The window relative horizontal location of the last press event

        Type:
        :   int in [-inf, inf], default 0, (readonly)

    mouse_prev_press_y
    :   The window relative vertical location of the last press event

        Type:
        :   int in [-inf, inf], default 0, (readonly)

    mouse_prev_x
    :   The window relative horizontal location of the mouse

        Type:
        :   int in [-inf, inf], default 0, (readonly)

    mouse_prev_y
    :   The window relative vertical location of the mouse

        Type:
        :   int in [-inf, inf], default 0, (readonly)

    mouse_region_x
    :   The region relative horizontal location of the mouse

        Type:
        :   int in [-inf, inf], default 0, (readonly)

    mouse_region_y
    :   The region relative vertical location of the mouse

        Type:
        :   int in [-inf, inf], default 0, (readonly)

    mouse_x
    :   The window relative horizontal location of the mouse

        Type:
        :   int in [-inf, inf], default 0, (readonly)

    mouse_y
    :   The window relative vertical location of the mouse

        Type:
        :   int in [-inf, inf], default 0, (readonly)

    ndof_motion
    :   NDOF motion event data

        Type:
        :   [`NDOFMotionEventData`](bpy.types.NDOFMotionEventData.html#bpy.types.NDOFMotionEventData "bpy.types.NDOFMotionEventData"), (readonly)

    oskey
    :   True when the Cmd key is held

        Type:
        :   boolean, default False, (readonly)

    pressure
    :   The pressure of the tablet or 1.0 if no tablet present

        Type:
        :   float in [0, 1], default 1.0, (readonly)

    shift
    :   True when the Shift key is held

        Type:
        :   boolean, default False, (readonly)

    tilt
    :   The pressure of the tablet or zeroes if no tablet present

        Type:
        :   [`mathutils.Vector`](mathutils.html#mathutils.Vector "mathutils.Vector") of 2 items in [-inf, inf], default (0.0, 0.0), (readonly)

    type
    :   Type:
        :   enum in [Event Type Items](bpy_types_enum_items/event_type_items.html#rna-enum-event-type-items), default `'NONE'`, (readonly)

    type_prev
    :   Type:
        :   enum in [Event Type Items](bpy_types_enum_items/event_type_items.html#rna-enum-event-type-items), default `'NONE'`, (readonly)

    unicode
    :   Single unicode character for this event

        Type:
        :   string, default “”, (readonly, never None)

    value
    :   The type of event, only applies to some

        Type:
        :   enum in [Event Value Items](bpy_types_enum_items/event_value_items.html#rna-enum-event-value-items), default `'NOTHING'`, (readonly)

    value_prev
    :   The type of event, only applies to some

        Type:
        :   enum in [Event Value Items](bpy_types_enum_items/event_value_items.html#rna-enum-event-value-items), default `'NOTHING'`, (readonly)

    xr
    :   XR event data

        Type:
        :   [`XrEventData`](bpy.types.XrEventData.html#bpy.types.XrEventData "bpy.types.XrEventData"), (readonly)

    *classmethod* bl_rna_get_subclass(*id*, *default=None*, */*)
    :   Parameters:
        :   **id** (*str*) – The RNA type identifier.

        Returns:
        :   The RNA type or default when not found.

        Return type:
        :   [`bpy.types.Struct`](bpy.types.Struct.html#bpy.types.Struct "bpy.types.Struct") subclass

    *classmethod* bl_rna_get_subclass_py(*id*, *default=None*, */*)
    :   Parameters:
        :   **id** (*str*) – The RNA type identifier.

        Returns:
        :   The class or default when not found.

        Return type:
        :   [type](#bpy.types.Event.type "bpy.types.Event.type")