Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import tkinter as tk
- import tkinter.filedialog as fd
- base=tk.Tk()
- def open():
- filename=fd.askopenfilename()
- print("open file "+filename)
- def exit():
- base.destroy()
- def find():
- print("file found")
- menubar=tk.Menu(base)
- filemenu=tk.Menu(menubar,tearoff=0)
- menubar.add_cascade(label="File",menu=filemenu)
- filemenu.add_command(label="open",command=open)
- filemenu.add_separator()
- filemenu.add_command(label="exit",command=exit)
- editmenu=tk.Menu(menubar,tearoff=0)
- menubar.add_cascade(label="edit",menu=editmenu)
- editmenu.add_command(label="find",command=find)
- base.config(menu=menubar)
- base.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement