Tkinter Widget-TopLevel
Toplevel widgets are used to create a Window, which are directly managed by the Window manager.
Syntax-
w = Toplevel (option)
Parameter-
Option- attribute of button widget.
Example-
- from tkinter import *
- main = Tk()
- t = Toplevel()
- t.mainloop()
Output-
Option | Description |
bg | It sets normal background color. |
bd | It sets border width in pixels. Default is 2. |
cursor | Cursor is used to create cursor in widgets like arrow, circle, dot etc. |
class_ | Normally, text selected within a text widget is exported to be the selection in the Window manager. Set exportselection=0, if you don't want that behavior. |
font | It is used to define a font of widgets |
fg | It sets normal foreground (text) color of widgets. |
height | It is used to define Window height. |
relief | Relief is a special type of border. The values are SUNKEN, RAISED, GROOVE, and RIDGE. |
width | It is used to define width of the Window. |
Summary
In this chapter, you learnt what Toplevel widget is and how to use the property of the widget.