textvariable help
Fredrik Lundh
fredrik at pythonware.com
Sat Jan 28 09:56:40 EST 2006
swisscheese wrote:
> I must be missing something basic.
> Can anyone explain why 'A' does not show on the entry widget?
>
> import Tkinter
> root = Tkinter.Tk()
> class Col:
> Rows = [0]
> def __init__(self):
> Frame = Tkinter.Frame(root);
> Frame.pack (side='left')
> self.Rows[0] = Tkinter.StringVar();
> Tkinter.Entry(Frame,textvariable=self.Rows[0]).pack ();
> X = Col()
> # X.Rows[0].set ('A') # 'A' displays in Entry this way
> Y = Col()
> X.Rows[0].set ('A') # Why not also this way?
> Y.Rows[0].set ('B')
> root.mainloop()
Rows is a class variable, and since you're modifying it in place, Rows[0] will
always be set to the most recently created Entry widget.
what is it you're trying to do here ?
</F>
More information about the Python-list
mailing list