Behavior of `show_viewport()` & `is_dearpygui_running()` after closing the viewport
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Needs clarification
- Activity status
- Stale
- Domain
- desktop-dev
Research direction
Start by tracing GContext->running through mvContext::StopRendering(), is_dearpygui_running(), mvHandleMsg(), and show_viewport(). Reproduce the Windows close-and-show sequence, including split_frame() and repeated show_viewport() calls, then establish the expected running state and verify that the behavior is consistent.
Written by the indexing model from the issue text.
Description
DearPyGui v2.2
Python v3.14
Windows 11
On Windows, closing the viewport window sets GContext->running to false via mvContext::StopRendering(). is_dearpygui_running() simply returns the result of GContext->running, so it makes sense that it returns False after closing the viewport. mvHandleMsg() destroys the viewport on close (I think), but calling show_viewport() will display the viewport again. Doing so does not update GContext->running, so any code that checks against it will fail e.g. split_frame(). Everything else seems to work as it should. This can be reproduced with a debugger and some bare-bones code:
from dearpygui import dearpygui as dpg
dpg.create_context()
dpg.setup_dearpygui()
dpg.create_viewport()
dpg.show_viewport()
while True:
dpg.render_dearpygui_frame()
The while-loop condition does not check is_dearpygui_running() and will to run after closing the viewport. Once the viewport is closed, set a breakpoint within the render loop and call show_viewport(). This can be done repeatedly in the same thread.
(Side node: After closing the viewport at least once, calling show_viewport() while the viewport is already displayed creates a "dead" viewport window.)
This behavior isn't documented and might be limited to Windows. However, I can easily see it being useful to display the viewport again once it's been closed. In its current state, many things appear to continue functioning properly, but it may have less-obvious side-effects (I don't have enough knowledge regarding DearPyGui's internals to say for certain). This issue is mostly just to make the behavior known.
- Dominant language
- C++
- Stars
- 15.7k
- Forks
- 790
- PR merge metrics
- No merged PRs in 30d
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from hoffstadt/DearPyGui
-
Plot series data silently truncated to float32 when passed as numpy array (should be float64/double)Openstate: pending type: bug
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
state: pending type: bug
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
-
state: pending type: improvement
Difficulty 3/5 1-2 days Newbie friendliness 35/100
-
state: pending type: bug
Difficulty 4/5 3-5 days Newbie friendliness 42/100
-
state: pending type: improvement
Difficulty 5/5 Over a week Newbie friendliness 25/100
All issues in hoffstadt/DearPyGui
Similar issues
-
[Windows] Hidden title bar: a maximized window restored from minimized on a secondary monitor gets the primary monitor's work area as its client areaPossibly taken @lijy91 claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
libnativeapi/nativeapi#53 · 1 reaction ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
Maintainers usually reply within 1 day
-
bot-triaged module: correctness (silent) module: fft triage review
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 68/100
patrickjquinn/Marathon-Shell#84 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 80/100
Maintainers usually reply within 1 day