Tkinter toggle a Label Widget based on checkbutton value
orsenthil at users.sourceforge.net
Wed Jul 4 21:51:34 CEST 2007
Following is a tk code, which will display a checkbutton, and when checkbox is
enabled, it will show the below present Label.
What I was trying is, when checkbox is enabled the Label should be shown and
when checkbox is disabled, the window should look like before.
But, I am finding that once enabled (shown), its not very-straightforward to
hide it from the window.
Any suggestions on how can i make this checkbutton effect.
1) Press Enable IP, the Label IP should be shown.
2) Toggle Enable IP (So that its unset). the Label IP should not be shown.
from Tkinter import *
root = Tk()
x = StringVar()
ip = Label(root,text="IP:")
proxy = Checkbutton(root, text="Enable IP:", variable = x,onvalue="proxy",
More information about the Python-list