Advertisement
here2share

# Tk_standard_menuform.py

Jul 31st, 2016
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.34 KB | None | 0 0
  1. # Tk_standard_menuform.py
  2. from Tkinter import *
  3.  
  4. def donothing():
  5.    filewin = Toplevel(root)
  6.    button = Button(filewin, text="Do nothing button")
  7.    button.pack()
  8.    
  9. root = Tk()
  10. menubar = Menu(root)
  11. filemenu = Menu(menubar, tearoff=0)
  12. filemenu.add_command(label="New", command=donothing)
  13. filemenu.add_command(label="Open", command=donothing)
  14. filemenu.add_command(label="Save", command=donothing)
  15. filemenu.add_command(label="Save as...", command=donothing)
  16. filemenu.add_command(label="Close", command=donothing)
  17.  
  18. filemenu.add_separator()
  19.  
  20. filemenu.add_command(label="Exit", command=root.quit)
  21. menubar.add_cascade(label="File", menu=filemenu)
  22. editmenu = Menu(menubar, tearoff=0)
  23. editmenu.add_command(label="Undo", command=donothing)
  24.  
  25. editmenu.add_separator()
  26.  
  27. editmenu.add_command(label="Cut", command=donothing)
  28. editmenu.add_command(label="Copy", command=donothing)
  29. editmenu.add_command(label="Paste", command=donothing)
  30. editmenu.add_command(label="Delete", command=donothing)
  31. editmenu.add_command(label="Select All", command=donothing)
  32.  
  33. menubar.add_cascade(label="Edit", menu=editmenu)
  34. helpmenu = Menu(menubar, tearoff=0)
  35. helpmenu.add_command(label="Help Index", command=donothing)
  36. helpmenu.add_command(label="About...", command=donothing)
  37. menubar.add_cascade(label="Help", menu=helpmenu)
  38.  
  39. root.config(menu=menubar)
  40. root.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement