30 lines
999 B
Python
30 lines
999 B
Python
![]() |
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()
|