From: fredrik at pythonware.com (Fredrik Lundh)
Date: Tue, 20 Apr 1999 10:01:02 GMT
Subject: Tkinter: some Labels not updating
References: <7fhdqo$dnl$1@agate.berkeley.edu>
Message-ID: <00b901be8b14$b45097e0$f29b12c2@pythonware.com>
Content-Length: 1341
X-UID: 400                                                  

python at pinky.cchem.berkeley.edu wrote:
> My Tkinter window has a Canvas with a bitmap image in one Frame,
> pull down menus in another Frame, and a few Buttons and Labels.  The
> Labels are supposed to indicate the values of certain variables which
> change when the user clicks on the canvas.  The first Label changes,
> but the others don't, they stay fixed at the values they had when
> I created the Label.
> 
> Is there a trick here or something I don't get?
> 
> I first create the StringVar:
> 
> self.X1v=StringVar()
> 
> Then I initialize X1v:
> 
> self.X1v.set("X1: not entered")
> 
> Then I make a Label object
> 
> self.l1=Label(tb, textvariable=self.X1v)
> self.l1.pack(side=TOP)
> 
> Then in the mouse callback (yes, it gets run, I have it print to stdout)
> 
>         self.X1v.set("X1: Got It")
> 
> But no update of the text in the label happens.  Updates _do_ happen
> in another Label object that is in a Frame by itself.  Do I need a
> separate Frame for each Label?  Do I have too many Label objects?

as far as I can tell, your program should work.  which means that
there's probably something you forgot to tell us.  try to make a
small but complete program that illustrates the problem.

(btw, if nothing else helps, you could skip the textvariables and
use self.l1.config(text="X1: Got it") instead...)

</F>





