-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmenubar.py
47 lines (31 loc) · 1.12 KB
/
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
36
37
38
39
40
41
42
43
44
45
46
47
from tkinter import *
def openFile():
print("File has been opened")
def saveFile():
print("File has been saved")
# editmenu
def cut():
print("You cut some text ")
def copy():
print("You copied some text ")
def paste():
print("You pasted some text ")
window = Tk()
openImage = PhotoImage(file="open.png")
saveImage = PhotoImage(file="save.png")
exitImage = PhotoImage(file="exit.png")
menubar = Menu(window)
window.config(menu=menubar)
filemenu = Menu(menubar, tearoff=0, font=("MV Boli", 15))
menubar.add_cascade(label="File", menu=filemenu)
filemenu.add_command(label="Open", command=openFile, image=openImage, compound='left')
filemenu.add_command(label="Save", command=saveFile, image=saveImage, compound='left')
filemenu.add_separator()
filemenu.add_command(label="Exit", command=quit, image=exitImage, compound='left')
# editmenu
editmenu = Menu(menubar, tearoff=0, font=("MV Boli", 15))
menubar.add_cascade(label="Edit", menu=editmenu)
editmenu.add_command(label="Cut", command=cut)
editmenu.add_command(label="Copy", command=copy)
editmenu.add_command(label="Paste", command=paste)
window.mainloop()