Skip to content

get_windows() returns all root items #2627

@Atlamillias

Description

@Atlamillias

Windows 10
Python v3.14.3
DearPyGui v2.2.0

import dearpygui.dearpygui as dpg

dpg.create_context()
dpg.setup_dearpygui()

dpg.add_window()
dpg.add_theme()
dpg.add_handler_registry()
dpg.add_item_handler_registry()

assert len(dpg.get_windows()) != 4, "too many items"

The issue with fixing this is that it's nice to have a performant option to get all top-level items. It's also behaved like this for...awhile, so maybe it's best to not fix it (although documenting it might be helpful).

Maybe we could make a new function, instead? Something like:

def get_existing_items(item_types: Sequence[int] | None = None) -> list[int]: ...

...where all items are returned when item_types == None (the current behavior of get_windows()) . Otherwise, only return items of types contained in item_types. Whether we fix it or create a new function, I can work on a PR for it.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions