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).
Asked: 2021-09-12 11:00:00 +0000
Seen: 11 times
Last updated: Dec 03 '22