this is simple project to toggle value of checkbuttons.
Checkbutton_object.toggle()
initially the checkbutton is uncheck
once clicked on button, value will get toggled, button will be checked
below is the code to toggle values of check button, GUI will look like as above image
#program
try:
from Tkinter import *
except:
from tkinter import *
def collect():
cb1.toggle()
mw = Tk()
v1 = IntVar()
mw.geometry("600x100+50+50")
mw.title("AETies : Automation Expert Technologies")
mw.config(background='#eeeeee')
l1 = Label(mw, text=' Select Skills : ', bg='#eeeeee')
l1.pack(side=LEFT)
cb1 = Checkbutton(mw, text='Python', bg='#eeeeee', var=v1, )
cb1.pack(side=LEFT)
bt = Button(mw, text=' click to toggle ', command=collect).pack(side=LEFT)
mainloop()
Comments
Post a Comment