-
Notifications
You must be signed in to change notification settings - Fork 9
/
example_menubar.py
35 lines (26 loc) · 965 Bytes
/
example_menubar.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import customtkinter
from CTkMenuBar import *
root = customtkinter.CTk()
root.geometry("600x200")
menu = CTkMenuBar(root)
button_1 = menu.add_cascade("File")
button_2 = menu.add_cascade("Edit")
button_3 = menu.add_cascade("Settings")
button_4 = menu.add_cascade("About")
dropdown1 = CustomDropdownMenu(widget=button_1)
dropdown1.add_option(option="Open", command=lambda: print("Open"))
dropdown1.add_option(option="Save")
dropdown1.add_separator()
sub_menu = dropdown1.add_submenu("Export As")
sub_menu.add_option(option=".TXT")
sub_menu.add_option(option=".PDF")
dropdown2 = CustomDropdownMenu(widget=button_2)
dropdown2.add_option(option="Cut")
dropdown2.add_option(option="Copy")
dropdown2.add_option(option="Paste")
dropdown3 = CustomDropdownMenu(widget=button_3)
dropdown3.add_option(option="Preferences")
dropdown3.add_option(option="Update")
dropdown4 = CustomDropdownMenu(widget=button_4)
dropdown4.add_option(option="Hello World")
root.mainloop()