Skip to content

Instantly share code, notes, and snippets.

@damp11113
Last active March 2, 2024 10:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save damp11113/f67eac027fda154f3490e401ad812ce8 to your computer and use it in GitHub Desktop.
Save damp11113/f67eac027fda154f3490e401ad812ce8 to your computer and use it in GitHub Desktop.
dearpygui project template
import dearpygui.dearpygui as dpg
class App:
def __init__(self):
pass
def window(self):
with dpg.window(label="Test"):
dpg.add_text("Hello world")
def init(self):
dpg.create_context()
dpg.create_viewport(title='Test', width=1280, height=720) # set viewport window
dpg.setup_dearpygui()
# -------------- add code here --------------
self.window()
# -------------------------------------------
dpg.show_viewport()
while dpg.is_dearpygui_running():
self.render()
dpg.render_dearpygui_frame()
dpg.destroy_context()
def render(self):
# insert here any code you would like to run in the render loop
# you can manually stop by using stop_dearpygui() or self.exit()
pass
def exit(self):
dpg.destroy_context()
app = App()
app.init()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment