`get_windows()` returns all root items

Open
#2,627 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
48/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Quiet
Tech stack
cpp, python
Domain
api, desktop

Research direction

Start with the provided Python reproduction using dpg.get_windows(), dpg.add_window(), and the other root-item constructors to confirm which items are returned. Trace the get_windows() entry point and determine whether its existing behavior should be corrected or documented alongside a separate item-query API; done means the intended result is covered by a regression test.

Written by the indexing model from the issue text.

Description

state: pending type: bug

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.

Dominant language
C++
Stars
15.7k
Forks
790
PR merge metrics
No merged PRs in 30d

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from hoffstadt/DearPyGui

All issues in hoffstadt/DearPyGui

Similar issues

More C++ issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.