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