How to make a Tkinter window jump to the front?

TkinterPythonServer Side ProgrammingProgramming

In order to make the tkinter window or the root window jump above all the other windows, we can use attributes method that will generally take two values specifying the “topmost” value and the other is a Boolean value.

Example

#Importing the library
from tkinter import *

#Create an instance of tkinter window or frame
win= Tk()

#Setting the geometry of window
win.geometry("600x250")

#Create a Label
Label(win, text= "Hello Everyone!",font=('Helvetica bold',
15)).pack(pady=20)

#Make the window jump above all
win.attributes('-topmost',1)

win.mainloop()

Output

Running the above code will make the window stay above all other windows,

raja
Published on 26-Mar-2021 10:40:32
Advertisements