-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcheck_box.py
More file actions
40 lines (33 loc) · 1.13 KB
/
check_box.py
File metadata and controls
40 lines (33 loc) · 1.13 KB
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
40
from tkinter import *
# Creating Display Function
def display():
if (x.get() == 1): print("You agree!")
else: print("You don't agree :(")
# Creating Window
window = Tk()
# Styling The Window
window.title("Check Box Program Tkinter")
window.geometry("400x400")
window.config(bg="gray")
# Import Image for Check Box
photo = PhotoImage(file="circles.png")
# Getting the value of x
x = IntVar()
# Making Check Box
check_button = Checkbutton(window,
text="I agree",
bg="black",
fg="#00ff00",
font=("Audiowide", 25, "bold"),
activebackground="black",
activeforeground="#00ff00",
variable=x,
onvalue=1,
offvalue=0,
command=display,
padx=25,
pady=10,
image=photo,
compound=LEFT)
check_button.pack()
window.mainloop() # Displaying Window