VOOZH about

URL: https://www.geeksforgeeks.org/python/python-tkinter-toplevel-widget/

⇱ Python Tkinter - Toplevel Widget - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Python Tkinter - Toplevel Widget

Last Updated : 12 Jul, 2025

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

Toplevel widget

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.

Syntax:  

toplevel = Toplevel(root, bg, fg, bd, height, width, font, ..)

Optional parameters  

  • 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. 

Common methods  

  • 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 1:  

Output

👁 python-tkinter-toplevel


Example 2: Creating Multiple toplevels over one another 

Comment