Ask Your Question
1

How can I keep the Tkinter window constantly displayed at the bottom?

asked 2023-07-05 00:48:52 +0000

djk gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2023-07-05 00:59:01 +0000

qstack gravatar image

To keep a Tkinter window constantly displayed at the bottom, you can use the wm_attributes method and set the -topmost attribute to True. This will ensure that the window always stays on top of other windows, even if they are brought to focus.

Here's some example code:

import tkinter as tk

root = tk.Tk()

# set the window size
root.geometry("300x200")

# set the window title
root.title("Bottom Window")

# keep the window at the bottom
root.wm_attributes("-topmost", True)

# start the main event loop
root.mainloop()

Note that setting the -topmost attribute to True can cause some issues with other applications, as the window will always be on top. Consider setting it to False when the window loses focus or when the user interacts with other applications.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2023-07-05 00:48:52 +0000

Seen: 8 times

Last updated: Jul 05 '23