DearPyGui icon indicating copy to clipboard operation
DearPyGui copied to clipboard

gui.configure_item needs time.sleep to show before exiting

Open ThisLimn0 opened this issue 2 years ago • 0 comments

Version of Dear PyGui

Version: 1.6.1 (Python 3.10.4) Operating System: Windows 10 Pro

My Issue/Question

I'm encountering an issue when i am closing the program via dearpygui.destroy_context(), right after updating an item to show right before the exit.

My program should show a visual to the user when exiting, but does that only when i set a minimal delay by putting a time.sleep command between gui.configure_item("exiting", show=True) and gui.destroy_context().

In the minimal example I provide below it seems to be no issue. But in the code i am running for my project exiting takes like 4 seconds and without the time.sleep(0.1) it still takes the 4 seconds just without the user notification that its exiting.

Expected behavior

The Program should show the window until it is closed like it does with the time.sleep command issued.

Standalone, minimal, complete and verifiable example

# Here's some code anyone can copy and paste to reproduce your issue
import dearpygui.dearpygui as gui
import time

gui.create_context()

def callback_handler(sender):
    print(f'{sender} was pressed')
    if sender == 24:
        gui.configure_item("exiting", show=True)
        print('Exiting...')
        time.sleep(0.1)
        gui.destroy_context()

with gui.window(label="Exiting", show=False, id="exiting", width=170, pos=(850,450), no_resize=True, no_title_bar=True):
    gui.add_text('Exiting...')


with gui.viewport_menu_bar():
    gui.add_menu_item(label="Exit", callback=callback_handler)

gui.create_viewport(title='Test', decorated=False, width=1920, height=1080)
gui.setup_dearpygui()


gui.show_viewport()
gui.start_dearpygui()
gui.destroy_context()

ThisLimn0 avatar May 03 '22 00:05 ThisLimn0