创建gui窗口
This commit is contained in:
30
dpg_main.py
Normal file
30
dpg_main.py
Normal file
@@ -0,0 +1,30 @@
|
||||
import dearpygui.dearpygui as dpg
|
||||
|
||||
dpg.create_context()
|
||||
|
||||
dpg.create_viewport(title='Custom Title', width=600, height=200)
|
||||
|
||||
def print_me(sender):
|
||||
print(f"Menu Item: {sender}")
|
||||
|
||||
with dpg.window(label="Tutorial"):
|
||||
with dpg.menu_bar():
|
||||
with dpg.menu(label="File"):
|
||||
dpg.add_menu_item(label="Save", callback=print_me)
|
||||
dpg.add_menu_item(label="Save As", callback=print_me)
|
||||
|
||||
with dpg.menu(label="Settings"):
|
||||
dpg.add_menu_item(label="Setting 1", callback=print_me, check=True)
|
||||
dpg.add_menu_item(label="Setting 2", callback=print_me)
|
||||
|
||||
dpg.add_menu_item(label="Help", callback=print_me)
|
||||
|
||||
with dpg.menu(label="Widget Items"):
|
||||
dpg.add_checkbox(label="Pick Me", callback=print_me)
|
||||
dpg.add_button(label="Press Me", callback=print_me)
|
||||
dpg.add_color_picker(label="Color Me", callback=print_me)
|
||||
|
||||
dpg.setup_dearpygui()
|
||||
dpg.show_viewport()
|
||||
dpg.start_dearpygui()
|
||||
dpg.destroy_context()
|
||||
Reference in New Issue
Block a user