-
Notifications
You must be signed in to change notification settings - Fork 0
/
Checkbox_Label.py
39 lines (38 loc) · 1.33 KB
/
Checkbox_Label.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import tkinter
from tkinter import messagebox
top = tkinter.Tk()
top.title("This is GUI.")
top.config(cursor="circle")
def print_selection():
if(var1.get()==1) & (var2.get()==0):
l.config(text="I love Veg.")
elif(var1.get()==0) & (var2.get()==1):
l.config(text="I Love Non Veg")
elif(var1.get()==0) & (var2.get()==0):
l.config(text="I don't like anything.")
else:
l.config(text="I Love both.")
l = tkinter.Label(top,bg="white",width=20,text=" ")
l.pack()
var1 = tkinter.IntVar()
var2 = tkinter.IntVar()
c1 = tkinter.Checkbutton(top,text="Veg",
variable=var1,
foreground="red",
background="yellow",
activebackground="blue",
bd=5,
font=("Helvetica","16"),
command=print_selection)
c1.pack()
c2 = tkinter.Checkbutton(top,
text="Non Veg",
variable=var2,
foreground="red",
background="yellow",
activebackground="blue",
bd=5,
font=("Helvetica","16"),
command=print_selection)
c2.pack()
top.mainloop()