Creating menus in Tkinter

The tkinter.Menu widget is used to implement menus in Tkinter applications; it's a fairly simple widget that acts as a container for any number of menu items.

The menu items can be one of the following five types:

  • command: These items are labeled buttons that, when clicked, run a callback.
  • checkbutton: These items are just like Checkbutton in our forms, and can be used to toggle BooleanVar.
  • radiobutton: These items are similar to Checkbutton, but can be used to switch any kind of Tkinter variable between several mutually exclusive options.
  • separator: These items are used to segment the menu into sections.
  • cascade: These items allow you to add a submenu to the menu. The submenu is just another tkinter.Menu object. ...

Get Python GUI Programming with Tkinter now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.