Toplevel Tkinter | Python 3
In this tutorial, we are going to see how to use Toplevel in Tkinter. The Toplevel widget works much like Frame, but it is displayed in a different top-level window. These windows usually have title bars, borders and other “decorations”.
Your application can use any number of top-level windows.

Syntax:
Here is the syntax to create this widget:
w = Toplevel ( option = value, ... )
Parameters:
- options : See below for a list of the most commonly used options for this widget. These options can be used as comma separated key-value pairs.
Example:
from tkinter import * gui = Tk() w = Toplevel() w.mainloop()
Output:

Toplevel widget’s options
bd | Border width in pixels. The default value is 0. |
bg | Background color of the window. |
cursor | The cursor that shows up when the mouse hovers over the window. |
font | The default font of the text inserted in the widget. |
fg | The color used for the text (and bitmaps) in the widget. You can change the color of the highlighted regions. |
height | Window height. |
relief | Relief represent the type of border. Some of the values are SUNKEN, RAISED, GROOVE and RIDGE. |
width | Desired width of the window. |
Methods:
Here are the commonly used methods for this widget:
frame() | Returns a system-specific window identifier. |
deiconify() | Display the window, after using the iconify or remove methods. |
group(window) | Adds the window to the group of windows managed by the given window. |
iconify() | Turns the window into an icon, without destroying it. |
protocol(name, function) | Save a function that will be called for the given protocol. |
state() | Returns the current state of the window. The possible values are normal, iconic, withdrawn and icon. |
title(string) | Sets the window title. |
sizefrom(who) | Sets the size controller. |
resizable(width, height) | Sets the resize flags, which control whether the window can be resized. |
positionfrom(who) | Sets the position controller. |
minsize(width, height) | Sets the minimum size of the window. |
maxsize(width, height) | Sets the maximum size of the window. |
withdraw() | Removes the window from the screen without destroying it. |