Python Tkinter – Toplevel Widget
Tkinter is a GUI toolkit used in python to make user-friendly GUIs.Tkinter is the most commonly used and the most basic GUI framework available in Python. Tkinter uses an object-oriented approach to make GUIs.
Note: For more information, refer to Python GUI – tkinter
A Toplevel widget is used to create a window on top of all other windows. The Toplevel widget is used to provide some extra information to the user and also when our program deals with more than one application. These windows are directly organized and managed by the Window Manager and do not need to have any parent window associated with them every time.
toplevel = Toplevel(root, bg, fg, bd, height, width, font, ..)
- root = root window(optional)
- bg = background colour
- fg = foreground colour
- bd = border
- height = height of the widget.
- width = width of the widget.
- font = Font type of the text.
- cursor = cursor that appears on the widget which can be an arrow, a dot etc.
- iconify turns the windows into icon.
- deiconify turns back the icon into window.
- state returns the current state of window.
- withdraw removes the window from the screen.
- title defines title for window.
- frame returns a window identifier which is system specific.
Example 2: Creating Multiple toplevels over one another
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning – Basic Level Course