On Dec 22, 1:42 pm, Fredrik Lundh <[EMAIL PROTECTED]> wrote: > Lie wrote: > >>> Inspect the following code: > > >>> --- start of code --- > >>> import Tkinter as Tk > >>> from Tkconstants import * > >>> root = Tk.Tk() > >>> e1 = Tk.Entry(root, text = 'Hello World') > >>> e2 = Tk.Entry(root, text = 'Hello World') > > >> the "text" (or "textvariable") option to the Entry widget is the name of > >> the Tcl variable that should hold the result. > > >> to get something that's a bit more usable from Python, use a StringVar > >> instance instead. alternatively, use the "get" method to fetch text > >> from the widget, and the "insert" method to add text to it. > > I realized that 'text' isn't a normally valid arguments for Entry (and > > I'm also aware about the insert, get, etc), but what makes me creep is > > the fact that the Entry's value would mirror each other if they're set > > to the same 'text' value > > note that you've set the "textvariable" option, not the "text" option. > Tk allows you to abbreviate option names. > > and since you've set the "textvariable" option for both widgets to the > same variable, you've asked them both to display the same variable. > Tkinter just does what you've asked it to. > > this is no different from using a Tkinter variable to display the same > value in a number of radiobutton widgets. > > </F>
But an expression (e.g. string) is NOT a variable. It's fine if the value mirrored when I set the textvariable conf to the same variable, but in this case I'm setting them to the same expression (e.g. string). -- http://mail.python.org/mailman/listinfo/python-list