Skip to content

Commit

Permalink
main : added loading indicator on startup example
Browse files Browse the repository at this point in the history
  • Loading branch information
my1e5 committed Aug 10, 2023
1 parent d26dd37 commit 1f44ccc
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions misc/loading_indicator_on_startup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import time
import dearpygui.dearpygui as dpg
dpg.create_context()

def long_process():
for i in range(10):
time.sleep(1)
dpg.add_button(label=f"Button {i}", parent=main_window)

def startup():
with dpg.window(modal=True, no_move=True, no_close=True, no_title_bar=True, no_resize=True) as loading_window:
dpg.add_text("Loading...")
dpg.add_loading_indicator()
long_process()
dpg.delete_item(loading_window)

with dpg.window() as main_window:
pass

dpg.set_frame_callback(1, startup)
dpg.set_primary_window(main_window, True)
dpg.create_viewport(width=800, height=600, title="Loading indicator on startup")
dpg.setup_dearpygui()
dpg.show_viewport()
dpg.start_dearpygui()
dpg.destroy_context()

0 comments on commit 1f44ccc

Please sign in to comment.