Python TopLevel Widget Tkinter
Last updated Dec 16, 2021Tkinter Toplevel widgets are used to layer windows on top of one another. They are specifically meant to provide the user with more information about the application he is operating. These widgets are mostly structured by the window manager, and they do not always need to have a parent window.
In this article, we'll look at how the Tkinter top-level works.
Syntax
The core syntax of the Tkinter Top level is as follows.
w = Toplevel ( option, ... )
|
Tkinter Level Options
The following are the most common options for creating TkinterTopLevel Widgets:
-
Bg- defines the window's background color.
-
Bd- specifies the window's border-radius.
-
Cursor- acceleration accelerates the behavior of the mouse pointer when it hovers over a window.
-
Class- exports the window manager of choice.
-
Font- specifies the window's font.
-
Fg-The color of the window has specified this option.
-
Height- specifies the height of the window.
-
Relief-The kind of window is defined by its option.
Tkinter TopLevel widget examples
from tkinter import * root = Tk() root.geometry("500x500") def open(): top = Toplevel(root) top.mainloop() btn = Button(root, text="click to open smalll window", command=open) btn.place(x=75, y=50) root.mainloop()
|
![]() |
Article Contributed By :
|
|
|
|
558 Views |