from Tkinter import *
master = Tk()
master.geometry('250x200')
def var_states():
print("Male : %d, \nFemale : %d" % (var1.get(), var2.get()))
def callbackFunc():
if (chkValue.get()):
tlabel = Label(master, text="Oh. I'm click value is {}".format(chkValue.get()))
tlabel.pack()
else:
tlabel = Label(master, text="Oh. I'm Not clicked")
tlabel.pack()
Label(master, text="Your sex:").grid(row=0, sticky=W)
var1 = IntVar()
Checkbutton(master, text="Male", variable=var1).grid(row=1, sticky=W)
var2 = IntVar()
Checkbutton(master, text="Female", variable=var2).grid(row=2, sticky=W)
Button(master, text="Quit", command=master.quit).grid(row=3, sticky=W, pady=4)
Button(master, text='Show', command=var_states).grid(row=4, sticky=W, pady=4)
chkValue = BooleanVar()
chkExample = Checkbutton(master, text="Check box", var=chkValue,command=callbackFunc)
chkExample.grid(column=10,row=10)
mainloop()
Cairo-Coders is the one place for high quality web development, Web Design and software development tutorials and Resources programming. Learn cutting edge techniques in web development, design and software development, download source components and participate in the community.
Showing posts with label Python-Tkinter. Show all posts
Showing posts with label Python-Tkinter. Show all posts
Python GUI Tkinter Checkbutton Tutorial
Python GUI Tkinter Checkbutton Tutorial
Subscribe to:
Posts (Atom)
