-
Notifications
You must be signed in to change notification settings - Fork 1
/
Tkinter Menubar 2.py
62 lines (42 loc) · 1.6 KB
/
Tkinter Menubar 2.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#;==========================================
#; Title: Tkinter MenuBar 2
#; Author: @AyemunHossain
#;==========================================
def action():
print("Acton !!!")
def why():
print("Why so serious man :) ")
import tkinter as tk
root = tk.Tk()
root.title("New Manu")
root.geometry('400x400')
menubar = tk.Menu(root)
root.config(menu=menubar)
#Created Edit Menu
fileMenu = tk.Menu(menubar, tearoff=0)
menubar.add_cascade(label="File", menu=fileMenu)
fileMenu.add_command(label="Open", command=action)
fileMenu.add_command(label="Save", command=action)
fileMenu.add_command(label="Save as", command=action)
fileMenu.add_separator()
fileMenu.add_command(label="Exit", command=root.quit)
#Created Edit Menu
editMenu = tk.Menu(menubar, tearoff=0)
menubar.add_cascade(label="Edit", menu=editMenu)
editMenu.add_command(label="Edit", command=action)
editMenu.add_command(label="Cut", command=action)
editMenu.add_command(label="Copy", command=action)
editMenu.add_command(label="Paste", command=action)
#Created Help Menu
helpMenu = tk.Menu(menubar, tearoff=0)
menubar.add_cascade(label="Help", menu=helpMenu)
helpMenu.add_command(label="About", command=action)
helpMenu.add_command(label="Help", command=action)
helpMenu.add_command(label="Ask a Question", command=action)
helpMenu.add_command(label="See Frequenly asked question", command=action)
helpMenu.add_command(label="Send Feadback", command=action)
label1 = tk.Label(text="Manubar",bg="red",fg="white",bd=10)
label1.pack(pady=20,fill=tk.X)
button1 = tk.Button(text="Click Me",width=10,bg='brown',fg='white',command=why)
button1.pack()
root.mainloop()