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

assistant: # WindowManager(ID)

base classes — [`bpy_struct`](bpy.types.bpy_struct.html#bpy.types.bpy_struct "bpy.types.bpy_struct"), [`ID`](bpy.types.ID.html#bpy.types.ID "bpy.types.ID")

*class* bpy.types.WindowManager(*ID*)
:   Window manager data-block defining open windows and other user interface data

    addon_filter
    :   Filter add-ons by category

        Type:
        :   enum in []

    addon_search
    :   Filter by add-on name, author & category

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

    addon_support
    :   Display support level

        - `OFFICIAL`
          Official – Officially supported.
        - `COMMUNITY`
          Community – Maintained by community developers.

        Type:
        :   enum set in {`'OFFICIAL'`, `'COMMUNITY'`}, default {`'COMMUNITY'`, `'OFFICIAL'`}

    addon_tags
    :   Type:
        :   [`bpy_prop_collection`](bpy.types.bpy_prop_collection.html#bpy.types.bpy_prop_collection "bpy.types.bpy_prop_collection") of `BlExtDummyGroup`, (readonly)

    asset_path_dummy
    :   Full path to the Blender file containing the active asset

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

    extension_search
    :   Filter by extension name, author & category

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

    extension_show_panel_available
    :   Only show installed extensions

        Type:
        :   boolean, default True

    extension_show_panel_installed
    :   Only show installed extensions

        Type:
        :   boolean, default True

    extension_tags
    :   Type:
        :   [`bpy_prop_collection`](bpy.types.bpy_prop_collection.html#bpy.types.bpy_prop_collection "bpy.types.bpy_prop_collection") of `BlExtDummyGroup`, (readonly)

    extension_type
    :   Show extensions by type

        - `ALL`
          All – Show all extension types.
        - `ADDON`
          Add-ons – Only show add-ons.
        - `THEME`
          Themes – Only show themes.

        Type:
        :   enum in [`'ALL'`, `'ADDON'`, `'THEME'`], default `'ADDON'`

    extensions_blocked
    :   Number of installed extensions which are blocked

        Type:
        :   int in [-inf, inf], default 0

    extensions_updates
    :   Number of extensions with available update

        Type:
        :   int in [-inf, inf], default 0

    is_interface_locked
    :   If true, the interface is currently locked by a running job and data should not be modified from application timers. Otherwise, the running job might conflict with the handler causing unexpected results or even crashes.

        Type:
        :   boolean, default False, (readonly)

    keyconfigs
    :   Registered key configurations

        Type:
        :   [`KeyConfigurations`](bpy.types.KeyConfigurations.html#bpy.types.KeyConfigurations "bpy.types.KeyConfigurations") [`bpy_prop_collection`](bpy.types.bpy_prop_collection.html#bpy.types.bpy_prop_collection "bpy.types.bpy_prop_collection") of [`KeyConfig`](bpy.types.KeyConfig.html#bpy.types.KeyConfig "bpy.types.KeyConfig"), (readonly)

    operators
    :   Operator registry

        Type:
        :   [`bpy_prop_collection`](bpy.types.bpy_prop_collection.html#bpy.types.bpy_prop_collection "bpy.types.bpy_prop_collection") of [`Operator`](bpy.types.Operator.html#bpy.types.Operator "bpy.types.Operator"), (readonly)

    poselib_previous_action
    :   Type:
        :   [`Action`](bpy.types.Action.html#bpy.types.Action "bpy.types.Action")

    preset_name
    :   Name for new preset

        Type:
        :   string, default “New Preset”, (never None)

    windows
    :   Open windows

        Type:
        :   [`bpy_prop_collection`](bpy.types.bpy_prop_collection.html#bpy.types.bpy_prop_collection "bpy.types.bpy_prop_collection") of [`Window`](bpy.types.Window.html#bpy.types.Window "bpy.types.Window"), (readonly)

    xr_session_settings
    :   Type:
        :   [`XrSessionSettings`](bpy.types.XrSessionSettings.html#bpy.types.XrSessionSettings "bpy.types.XrSessionSettings"), (readonly, never None)

    xr_session_state
    :   Runtime state information about the VR session

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

    clipboard
    :   Clipboard text storage.

        Type:
        :   str

    *classmethod* fileselect_add(*operator*)
    :   Opens a file selector with an operator.

        Parameters:
        :   **operator** ([`Operator`](bpy.types.Operator.html#bpy.types.Operator "bpy.types.Operator")) – Operator to call

        This method is used from the operators `invoke` callback
        which must then return `{'RUNNING_MODAL'}`.

        Accepting the file selector will run the operators `execute` callback.

        The following properties are supported:

        `filepath`: `bpy.props.StringProperty(subtype='FILE_PATH')`
        :   Represents the absolute path to the file.

        `dirpath`: `bpy.props.StringProperty(subtype='DIR_PATH')`
        :   Represents the absolute path to the directory.

        `filename`: `bpy.props.StringProperty(subtype='FILE_NAME')`
        :   Represents the filename without the leading directory.

        `files`: `bpy.props.CollectionProperty(type=bpy.types.OperatorFileListElement)`
        :   When present in the operator this collection includes all selected files.

        `filter_glob`: `bpy.props.StringProperty(default="*.ext")`
        :   When present in the operator and it’s not empty,
            it will be used as a file filter (example value: `*.zip;*.py;*.exe`).

        `check_existing`: `bpy.props.BoolProperty()`
        :   If this property is present and set to `True`,
            the operator will warn if the provided file-path already exists
            by highlighting the filename input field in red.

    *classmethod* modal_handler_add(*operator*)
    :   Add a modal handler to the window manager, for the given modal operator (called by invoke() with self, just before returning {‘RUNNING_MODAL’})

        Parameters:
        :   **operator** ([`Operator`](bpy.types.Operator.html#bpy.types.Operator "bpy.types.Operator")) – Operator to call

        Returns:
        :   Whether adding the handler was successful

        Return type:
        :   boolean

    event_timer_add(*time_step*, *\**, *window=None*)
    :   Add a timer to the given window, to generate periodic ‘TIMER’ events

        Parameters:
        :   - **time_step** (*float in* *[**0**,* *inf**]*) – Time Step, Interval in seconds between timer events
            - **window** ([`Window`](bpy.types.Window.html#bpy.types.Window "bpy.types.Window"), (optional)) – Window to attach the timer to, or None

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

    event_timer_remove(*timer*)
    :   event_timer_remove

    *classmethod* gizmo_group_type_ensure(*identifier*)
    :   Activate an existing widget group (when the persistent option isn’t set)

        Parameters:
        :   **identifier** (*string**,* *(**never None**)*) – Gizmo group type name

    *classmethod* gizmo_group_type_unlink_delayed(*identifier*)
    :   Unlink a widget group (when the persistent option is set)

        Parameters:
        :   **identifier** (*string**,* *(**never None**)*) – Gizmo group type name

    progress_begin(*min*, *max*)
    :   Start progress report

        Parameters:
        :   - **min** (*float in* *[**-inf**,* *inf**]*) – min, any value in range [0,9999]
            - **max** (*float in* *[**-inf**,* *inf**]*) – max, any value in range [min+1,9998]

    progress_update(*value*)
    :   Update the progress feedback

        Parameters:
        :   **value** (*float in* *[**-inf**,* *inf**]*) – value, Any value between min and max as set in progress_begin()

    progress_end()
    :   Terminate progress report

    *classmethod* invoke_props_popup(*operator*, *event*)
    :   Operator popup invoke (show operator properties and execute it automatically on changes)

        Parameters:
        :   - **operator** ([`Operator`](bpy.types.Operator.html#bpy.types.Operator "bpy.types.Operator")) – Operator to call
            - **event** ([`Event`](bpy.types.Event.html#bpy.types.Event "bpy.types.Event")) – Event

        Returns:
        :   result

        Return type:
        :   enum set in [Operator Return Items](bpy_types_enum_items/operator_return_items.html#rna-enum-operator-return-items)

    *classmethod* invoke_props_dialog(*operator*, *\**, *width=300*, *title=''*, *confirm_text=''*, *cancel_default=False*, *text_ctxt=''*, *translate=True*)
    :   Operator dialog (non-autoexec popup) invoke (show operator properties and only execute it on click on OK button)

        Parameters:
        :   - **operator** ([`Operator`](bpy.types.Operator.html#bpy.types.Operator "bpy.types.Operator")) – Operator to call
            - **width** (*int in* *[**0**,* *inf**]**,* *(**optional**)*) – Width of the popup
            - **title** (*string**,* *(**optional**,* *never None**)*) – Title, Optional text to show as title of the popup
            - **confirm_text** (*string**,* *(**optional**,* *never None**)*) – Confirm Text, Optional text to show instead to the default “OK” confirmation button text
            - **cancel_default** (*boolean**,* *(**optional**)*) – cancel_default
            - **text_ctxt** (*string**,* *(**optional**)*) – Override automatic translation context of the given text
            - **translate** (*boolean**,* *(**optional**)*) – Translate the given text, when UI translation is enabled

        Returns:
        :   result

        Return type:
        :   enum set in [Operator Return Items](bpy_types_enum_items/operator_return_items.html#rna-enum-operator-return-items)

    *classmethod* invoke_search_popup(*operator*)
    :   Operator search popup invoke which searches values of the operator’s [`bpy.types.Operator.bl_property`](bpy.types.Operator.html#bpy.types.Operator.bl_property "bpy.types.Operator.bl_property") (which must be an EnumProperty), executing it on confirmation

        Parameters:
        :   **operator** ([`Operator`](bpy.types.Operator.html#bpy.types.Operator "bpy.types.Operator")) – Operator to call

    *classmethod* invoke_popup(*operator*, *\**, *width=300*)
    :   Operator popup invoke (only shows operator’s properties, without executing it)

        Parameters:
        :   - **operator** ([`Operator`](bpy.types.Operator.html#bpy.types.Operator "bpy.types.Operator")) – Operator to call
            - **width** (*int in* *[**0**,* *inf**]**,* *(**optional**)*) – Width of the popup

        Returns:
        :   result

        Return type:
        :   enum set in [Operator Return Items](bpy_types_enum_items/operator_return_items.html#rna-enum-operator-return-items)

    *classmethod* invoke_confirm(*operator*, *event*, *\**, *title=''*, *message=''*, *confirm_text=''*, *icon='NONE'*, *text_ctxt=''*, *translate=True*)
    :   Operator confirmation popup (only to let user confirm the execution, no operator properties shown)

        Parameters:
        :   - **operator** ([`Operator`](bpy.types.Operator.html#bpy.types.Operator "bpy.types.Operator")) – Operator to call
            - **event** ([`Event`](bpy.types.Event.html#bpy.types.Event "bpy.types.Event")) – Event
            - **title** (*string**,* *(**optional**,* *never None**)*) – Title, Optional text to show as title of the popup
            - **message** (*string**,* *(**optional**,* *never None**)*) – Message, Optional first line of content text
            - **confirm_text** (*string**,* *(**optional**,* *never None**)*) – Confirm Text, Optional text to show instead to the default “OK” confirmation button text
            - **icon** (enum in [`'NONE'`, `'WARNING'`, `'QUESTION'`, `'ERROR'`, `'INFO'`], (optional)) – Icon, Optional icon displayed in the dialog
            - **text_ctxt** (*string**,* *(**optional**)*) – Override automatic translation context of the given text
            - **translate** (*boolean**,* *(**optional**)*) – Translate the given text, when UI translation is enabled

        Returns:
        :   result

        Return type:
        :   enum set in [Operator Return Items](bpy_types_enum_items/operator_return_items.html#rna-enum-operator-return-items)

    *classmethod* popmenu_begin__internal(*title*, *\**, *icon='NONE'*)
    :   popmenu_begin__internal

        Parameters:
        :   **icon** (enum in [Icon Items](bpy_types_enum_items/icon_items.html#rna-enum-icon-items), (optional)) – icon

        Return type:
        :   [`UIPopupMenu`](bpy.types.UIPopupMenu.html#bpy.types.UIPopupMenu "bpy.types.UIPopupMenu"), (never None)

    *classmethod* popmenu_end__internal(*menu*)
    :   popmenu_end__internal

    *classmethod* popover_begin__internal(*\**, *ui_units_x=0*, *from_active_button=False*)
    :   popover_begin__internal

        Parameters:
        :   - **ui_units_x** (*int in* *[**0**,* *inf**]**,* *(**optional**)*) – ui_units_x
            - **from_active_button** (*boolean**,* *(**optional**)*) – Use Button, Use the active button for positioning

        Return type:
        :   [`UIPopover`](bpy.types.UIPopover.html#bpy.types.UIPopover "bpy.types.UIPopover"), (never None)

    *classmethod* popover_end__internal(*menu*, *\**, *keymap=None*)
    :   popover_end__internal

        Parameters:
        :   **keymap** ([`KeyMap`](bpy.types.KeyMap.html#bpy.types.KeyMap "bpy.types.KeyMap"), (optional)) – Key Map, Active key map

    *classmethod* piemenu_begin__internal(*title*, *\**, *icon='NONE'*, *event=None*)
    :   piemenu_begin__internal

        Parameters:
        :   **icon** (enum in [Icon Items](bpy_types_enum_items/icon_items.html#rna-enum-icon-items), (optional)) – icon

        Return type:
        :   [`UIPieMenu`](bpy.types.UIPieMenu.html#bpy.types.UIPieMenu "bpy.types.UIPieMenu"), (never None)

    *classmethod* piemenu_end__internal(*menu*)
    :   piemenu_end__internal

    *classmethod* operator_properties_last(*operator*)
    :   operator_properties_last

        Return type:
        :   [`OperatorProperties`](bpy.types.OperatorProperties.html#bpy.types.OperatorProperties "bpy.types.OperatorProperties"), (never None)

    print_undo_steps()
    :   print_undo_steps

    *classmethod* tag_script_reload()
    :   Tag for refreshing the interface after scripts have been reloaded

    popover(*draw_func*, *\**, *ui_units_x=0*, *keymap=None*, *from_active_button=False*)

    popup_menu(*draw_func*, *\**, *title=''*, *icon='NONE'*)
    :   Popup menus can be useful for creating menus without having to register menu classes.

        Note that they will not block the scripts execution, so the caller can’t wait for user input.

        ```
        import bpy

        def draw(self, context):
            self.layout.label(text="Hello World")

        bpy.context.window_manager.popup_menu(draw, title="Greeting", icon='INFO')
        ```

    popup_menu_pie(*event*, *draw_func*, *\**, *title=''*, *icon='NONE'*)

    *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

    *classmethod* draw_cursor_add(*callback*, *args*, *space_type*, *region_type*)
    :   Add a new draw cursor handler to this space type.
        It will be called every time the cursor for the specified region in the space type will be drawn.
        Note: All arguments are positional only for now.

        Parameters:
        :   - **callback** (*Callable**[**...**,* *Any**]*) – A function that will be called when the cursor is drawn.
              It gets the specified arguments as input with the mouse position (`tuple[int, int]`) as last argument.
            - **args** (*tuple**[**Any**,* *...**]*) – Arguments that will be passed to the callback.
            - **space_type** (*str*) – The space type the callback draws in; for example `VIEW_3D`. ([`bpy.types.Space.type`](bpy.types.Space.html#bpy.types.Space.type "bpy.types.Space.type"))
            - **region_type** (*str*) – The region type the callback draws in; usually `WINDOW`. ([`bpy.types.Region.type`](bpy.types.Region.html#bpy.types.Region.type "bpy.types.Region.type"))

        Returns:
        :   Handler that can be removed later on.

        Return type:
        :   object

    *classmethod* draw_cursor_remove(*handler*)
    :   Remove a draw cursor handler that was added previously.

        Parameters:
        :   **handler** (*object*) – The draw cursor handler that should be removed.