#2173·DearPyGui

destroy_context doesn't clean up the window

Author: dav0deaCreated Sep 10, 2023Updated Jun 13, 2026
Labelsstate: pendingtype: bug

Version of Dear PyGui

Version: 1.9.1 Operating System: Ubuntu 22.04 (KDE Plasma 5.27.7)

My Issue

Calling dpg.destroy_context() doesn't close the window, but just makes it unresponsive. This seems like a very basic thing, so maybe there's something wrong with my OS or window manager? It works as expected on my Windows 11 system. I also tried a range of DPG versions, all of them have the same issue on my Linux system.

To Reproduce

Run the code below and simply close the window by clicking on the x. The window doesn't close but just becomes unresponsive. It does unblock dpg.start_dearpygui(), calls destroy_context and goes into the while True loop as expected.

image

Expected behavior

The window should close properly.

Standalone, minimal, complete and verifiable example

python
import dearpygui.dearpygui as dpg

dpg.create_context()
dpg.create_viewport()
dpg.setup_dearpygui()

with dpg.window(label="tutorial"):
    dpg.add_text("Hello world")

dpg.show_viewport()
dpg.start_dearpygui()
dpg.destroy_context()

print("window closed")

while True:
    pass