Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Tk_config_widgets_2_retain_size.py
- import Tkinter
- root = Tkinter.Tk()
- msg1 = ['Hide Label','Show Label']
- msg2 = ['Back Again!','']
- sw = 0
- button = Tkinter.Button(root, text=msg1[sw])
- button.pack()
- label = Tkinter.Label(root, text=">>> Label <<<")
- def switch():
- global sw
- sw=(1,0)[sw]
- print sw
- button.config(text=msg1[sw])
- label.config(text=msg2[sw])
- button.pack()
- label.pack()
- button.config(command=switch)
- root.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement