Skip to content

Commit

Permalink
Check Box
Browse files Browse the repository at this point in the history
  • Loading branch information
Ronish authored and Ronish committed Apr 27, 2021
1 parent 7d62edc commit f3a777b
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions CheckBox.py
Original file line number Diff line number Diff line change
@@ -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()

0 comments on commit f3a777b

Please sign in to comment.