53 lines
1.5 KiB
Plaintext
53 lines
1.5 KiB
Plaintext
From: python at pinky.cchem.berkeley.edu (python at pinky.cchem.berkeley.edu)
|
|
Date: 20 Apr 1999 08:28:08 GMT
|
|
Subject: Tkinter: some Labels not updating
|
|
Message-ID: <7fhdqo$dnl$1@agate.berkeley.edu>
|
|
Content-Length: 1232
|
|
X-UID: 303
|
|
|
|
Hi,
|
|
|
|
I'm writing a small app using Python and Tkinter and I'm having trouble
|
|
with some Label objects not updating when I set the StringVar object
|
|
attached to the textvariable of the Label.
|
|
|
|
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?
|
|
Any workarounds? Post or e-mail replys.
|
|
|
|
Thanks,
|
|
|
|
JDM -- python enthusiast whose reach exceeds his grasp. :)
|
|
|
|
|
|
|
|
|
|
|