- Trending Categories
- Data Structure
- Operating System
- MS Excel
- C Programming
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to put a Toplevel window in front of the main window in Tkinter?
The Tkinter Toplevel window creates an additional window apart from the main window. We can add widgets and components to the newly created top-level window. It supports all the properties of the parent or main window.
Sometimes the Toplevel window is also referred to as the child window. To put the child window in front of the parent window, we can use the wm_transient() method.
# Import the required libraries from tkinter import * from tkinter import ttk # Create an instance of tkinter frame or window win=Tk() # Set the size of the window win.geometry("700x350") win.title("Parent Window") # Create a Toplevel window top=Toplevel(win) top.geometry('600x250') top.title("Child Window") # Place the toplevel window at the top top.wm_transient(win) win.mainloop()
If we run the above code, it will display a Toplevel window in front of the main window.
- Related Articles
- How to keep the window focus on the new Toplevel() window in Tkinter?
- How to close only the TopLevel window in Python Tkinter?
- How to bring Tkinter window in front of other windows?
- How to make a Tkinter window jump to the front?
- Python Tkinter – How to position a topLevel() widget relative to the root window?
- How to put a Tkinter window on top of the others?
- Placing plot on Tkinter main window in Python
- How to draw images in the Tkinter window?
- How to show webcam in TkInter Window?
- How to center a window on the screen in Tkinter?
- Tkinter-How to get the current date to display in a tkinter window?
- Function to close the window in Tkinter
- How to make Tkinter Window appear in the taskbar?
- Android Studio Main Window
- How to control automated window resizing in Tkinter?