Ask Your Question
0

What is the method for placing a tkinter textbox in the bottom right corner of a window?

asked 2021-09-12 11:00:00 +0000

lalupa gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
3

answered 2022-12-03 18:00:00 +0000

nofretete gravatar image

One way to place a tkinter textbox in the bottom right corner of a window is to use the place method with the anchor and relx/rely options.

Here is an example code snippet:

import tkinter as tk

root = tk.Tk()

# create a textbox
textbox = tk.Text(root, height=10, width=50)

# place the textbox in the bottom right corner
textbox.place(relx=1.0, rely=1.0, anchor='se')

root.mainloop()

Explanation: - The relx=1.0 option sets the horizontal position of the textbox to be at the right edge of the window, as a percentage of the window width (1.0 means 100%). - The rely=1.0 option sets the vertical position of the textbox to be at the bottom edge of the window, as a percentage of the window height (1.0 means 100%). - The anchor='se' option sets the reference point of the textbox to be the bottom right corner of its bounding box (i.e., the opposite corner from where it starts).

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: 2021-09-12 11:00:00 +0000

Seen: 11 times

Last updated: Dec 03 '22