-
Notifications
You must be signed in to change notification settings - Fork 0
/
check_boxes.py
34 lines (29 loc) · 1.05 KB
/
check_boxes.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
from tkinter import *
def display():
if x.get() == 1:
print("You Agree!")
else:
print("You don't agree :(")
window = Tk()
x = IntVar()
python_photo = PhotoImage(file='python.png')
check_button = Checkbutton(window,
text="I agree to something",
variable=x,
onvalue=1,
offvalue=0,
command=display,
font=('Time New Roman', 20, 'italic'),
fg='green',
bg='black',
activeforeground='green',
activebackground='black',
padx=25,
pady=10,
image=python_photo,
compound='left')
check_button.pack()
window.mainloop()
# with the onvalue and off value if you are changing the value from
# int to boolean make sure you change also the variable type .x = Intvar()
# x = booleanvar()