Python tkinter label won't change at beginning of function Python tkinter label won't change at beginning of function tkinter tkinter

Python tkinter label won't change at beginning of function


Since you're doing all of this in a single method call, the GUI never gets a chance to update before you start your sub process. Check out update_idletasks() call...

from http://infohost.nmt.edu/tcc/help/pubs/tkinter/universal.html

w.update_idletasks()Some tasks in updating the display, such as resizing and redrawing widgets, are called idle tasks because they are usually deferred until the application has finished handling events and has gone back to the main loop to wait for new events.
If you want to force the display to be updated before the application next idles, call the w.update_idletasks() method on any widget.


How are you creating your Label?I have this little test setup:

from Tkinter import *class LabelTest:    def __init__(self, master):        self.test = StringVar()        self.button = Button(master, text="Change Label", command=self.change)        self.button.grid(row=0, column=0, sticky=W)        self.test.set("spam")        self.testlabel = Label(master, textvariable = self.test).grid(row = 0,column = 1)    def change(self):        self.test.set("eggs")root = Tk()root.title("Label tester")calc = LabelTest(root)root.mainloop()

And it works.Did you make sure to use "textvariable = StatusBarText" instead of "text=StatusBarText.get()"?