Reputation: 69
I have some tk.Entry()s in my gui. The text inside the entries is always right-aligned. But once the text is larger than the box, the text is left-aligned.
Sample-Code:
import tkinter as tk
root = tk.Tk()
small_text = "abc"
big_text = "abcdefghijklmnopqrstuvwxyz"
small_entry = tk.Entry(root, width=10, justify="right")
big_entry = tk.Entry(root, width=10, justify="right")
small_entry.insert(0, small_text)
big_entry.insert(0, big_text)
small_entry.pack()
big_entry.pack()
# what i want to see for big_entry:
wanna_see_text = "qrstuvwxyz"
wanna_see_entry = tk.Entry(root, width=10, justify="right")
wanna_see_entry.insert(0, wanna_see_text)
wanna_see_entry.pack()
root.mainloop()
The result:
The first box is perfect. Second box contains whole alphabet but it's left-aligned. I want that the second box looks like the third box even if it contains the entire alphabet,
Thanks for your help :)
Upvotes: 2
Views: 5041