From f3a777bdd43a091dea69bb75355e728fd3703973 Mon Sep 17 00:00:00 2001 From: Ronish Date: Tue, 27 Apr 2021 12:20:19 +0545 Subject: [PATCH] Check Box --- CheckBox.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 CheckBox.py diff --git a/CheckBox.py b/CheckBox.py new file mode 100644 index 0000000..351e99d --- /dev/null +++ b/CheckBox.py @@ -0,0 +1,22 @@ +from tkinter import * +from PIL import ImageTk, Image +from tkinter import messagebox +from tkinter import filedialog + +root = Tk() +root.title("Check Box") +root.iconbitmap("image.ico") + +def show(): + myLabel = Label(root, text=var.get()).pack() + +var = StringVar() +#Anything can be written in on or off string input +checkButton = Checkbutton(root, text="Check this box!", variable = var, onvalue='On', offvalue="Off") +#Automatic selection on check box will be removed +checkButton.deselect() +checkButton.pack() + +myButton = Button(root, text= "Show selection", command=show).pack() + +mainloop() \ No newline at end of file