20 December 2014

Create a menu to your Python Tkinter application window. Create a simple pulldown / dropdown menu using TK in Python.

Source code viewer
  1. from tkinter import Tk, mainloop, Menu
  2.  
  3. root = Tk()
  4.  
  5. # Menus
  6. menu_bar = Menu(root)
  7.  
  8. file_menu = Menu(menu_bar, tearoff=0)
  9. file_menu.add_command(label="Exit", command=root.quit)
  10. menu_bar.add_cascade(label="File", menu=file_menu)
  11.  
  12. root.config(menu=menu_bar)
  13. # END - Menus
  14.  
  15. mainloop()
Programming Language: Python