Let's get our Hello World application working as intended again using our new knowledge of Tkinter variables. After setting the title, change the label_text property as follows:
self.label_text = tk.StringVar()self.label_text.set("Choose One")
Now, alter our other two methods like so:
def say_hello(self): self.label_text.set("Hello World")def say_goodbye(self): self.label_text.set("Goodbye! \n (Closing in 2 seconds)") self.after(2000, self.destroy)
Once again, run the application and click both buttons. Everything should now be all working as before.
Great! We now know how to take advantage of Tkinter's special variables, and it's super easy.