Skip to content

Commit cd25915

Browse files
authoredMay 29, 2023
Create example_titlemenu.py
1 parent 2860c85 commit cd25915

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed
 

‎example_titlemenu.py

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import customtkinter
2+
from CTkMenuBar import *
3+
4+
root = customtkinter.CTk()
5+
root.geometry("600x200")
6+
7+
menu = CTkTitleMenu(root)
8+
button_1 = menu.add_cascade("File")
9+
button_2 = menu.add_cascade("Edit")
10+
button_3 = menu.add_cascade("Settings")
11+
button_4 = menu.add_cascade("About")
12+
13+
dropdown1 = CustomDropdownMenu(widget=button_1)
14+
dropdown1.add_option(option="Open", command=lambda: print("Open"))
15+
dropdown1.add_option(option="Save")
16+
17+
dropdown1.add_separator()
18+
19+
sub_menu = dropdown1.add_submenu("Export As")
20+
sub_menu.add_option(option=".TXT")
21+
sub_menu.add_option(option=".PDF")
22+
23+
dropdown2 = CustomDropdownMenu(widget=button_2)
24+
dropdown2.add_option(option="Cut")
25+
dropdown2.add_option(option="Copy")
26+
dropdown2.add_option(option="Paste")
27+
28+
dropdown3 = CustomDropdownMenu(widget=button_3)
29+
dropdown3.add_option(option="Preferences")
30+
dropdown3.add_option(option="Update")
31+
32+
dropdown4 = CustomDropdownMenu(widget=button_4)
33+
dropdown4.add_option(option="Hello World")
34+
35+
root.mainloop()

0 commit comments

Comments
 (0)
Please sign in to comment.