Entry Text Option: Curious Behavior
Consider the following code: import tkinter as tk FONT='Arial 20 bold' app = tk.Tk() tk.Entry(app,text='hi', font=FONT).pack() tk.Entry(app,text='hi', font=FONT).pack() app.ma
Solution 1:
The problem lies with the text
parameter actually. By passing text
you are creating a textvariable
of the Entry
widget:
import tkinter as tk
FONT="Arial 20 bold"
app = tk.Tk()
a = tk.Entry(app, text="hi", font=FONT)
b = tk.Entry(app, text="there", font=FONT)
c = tk.Entry(app, text="hi", font=FONT)
for i in (a,b,c):
i.pack()
print (i["textvariable"])
app.mainloop()
To fix this problem - simply don't pass text
as a parameter. I don't think you need it anyways.
Post a Comment for "Entry Text Option: Curious Behavior"