Tkinter toggle a Label Widget based on checkbutton value

Wojciech Muła wojciech_mula at poczta.null.onet.pl.invalid
Wed Jul 4 22:13:06 CEST 2007


O.R.Senthil Kumaran wrote:
> 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.
>
> #!/usr/bin/python
> from Tkinter import *
> root = Tk()
> root.title('something')
> x = StringVar()

ip = Label(root,text="IP:")
> def display():
      global ip
>     if x.get():
>         #ip = Label(root,text="IP:")
>         ip.grid(row=3,column=0)
       else:
          ip.grid_forget()



More information about the Python-list mailing list