April 2018
Beginner
340 pages
7h 54m
English
The top menu bar of an application usually just contains other menus, such as file and edit. These are known as "cascades" in Tkinter, and are essentially a menu inside a menu. This may be confusing at first, so let's begin with a very simple example to demonstrate the difference between a menu and a cascade.
Create a new Python file called menu.py and add the following code:
import tkinter as tkwin = tk.Tk()win.geometry('400x300')lab = tk.Label(win, text="Demo application")menu = tk.Menu(win)
After importing Tkinter and creating a main window and Label, we make our first Menu widget. As with a lot of widgets, the first argument needed is the master, or parent, in which the widget will be drawn. We draw this menu in our main window ...
Read now
Unlock full access