-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path33.CheckBox.py
More file actions
38 lines (23 loc) · 765 Bytes
/
33.CheckBox.py
File metadata and controls
38 lines (23 loc) · 765 Bytes
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
from tkinter import *
from tkinter import IntVar
tk = Tk()
tk.geometry('500x500')
tk.title('Drop Down Menu')
lab = Label(tk, text="")
lab.pack()
def Check_Funct():
if (X1.get() == 1) & (X2.get() == 0):
lab.config(text='Item 1 selected ')
elif (X1.get() == 0) & (X2.get() == 1):
lab.config(text='Item 0 selected ')
elif (X1.get() == 0) & (X2.get() == 0):
lab.config(text='Not selected anything')
else:
lab.config(text='Item 1 and 2 Selected ')
X1 = IntVar()
X2 = IntVar()
check1 = Checkbutton(tk, text='Item 1',variable=X1, onvalue=1, offvalue=0, command=Check_Funct)
check1.pack()
check2 = Checkbutton(tk, text='C++',variable=X2, onvalue=1, offvalue=0, command=Check_Funct)
check2.pack()
tk.mainloop()