-
Notifications
You must be signed in to change notification settings - Fork 68
/
Copy pathcheck_box.py
37 lines (36 loc) · 1.31 KB
/
check_box.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
import tkinter as tk
from tkinter import messagebox
win = tk.Tk()
win.geometry("550x500+500+200")
win.configure(background='white')
def jk():
# display
if(Red.get() and Green.get() and Blue.get()):
Selection = "You checked Red green and Blue"
elif(Red.get() and Green.get()):
Selection = "You checked Red and green"
elif(Red.get() and Blue.get()):
Selection = "You checked Red and Blue"
elif(Green.get() and Blue.get()):
Selection = "You checked Green and Blue"
elif(Green.get()):
Selection = "You checked Green"
elif(Blue.get()):
Selection = "You checked Blue"
elif(Red.get()):
Selection = "You checked Red"
else:
Selection = "You Unchecked All"
label.config(text = Selection)
Red = tk.BooleanVar()
Green = tk.BooleanVar()
Blue = tk.BooleanVar()
l4 = tk.Checkbutton(win,text="Red", var=Red, command=jk, selectcolor="cyan", font="elephant",fg="red",bg="gray")
l4.place(x=100,y=100)
l5 = tk.Checkbutton(win,text="green", var=Green, command=jk, bg="gray", selectcolor="cyan", font="elephant",fg="green")
l5.place(x=100,y=200)
l6 = tk.Checkbutton(win,text="Blue", var=Blue, command=jk, bg="gray", selectcolor="cyan", font="elephant",fg="blue")
l6.place(x=100,y=300)
label = tk.Label(win)
label.pack()
win.mainloop()