Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from tkinter import *
- root = Tk()
- off_color = "red"
- on_color = "green"
- def on_check():
- if cbVar.get() == "1":text["fg"] = on_color
- else:text["fg"] = off_color
- cbVar = StringVar(root)
- cbVar.set(0)
- chbox = Checkbutton(root,variable = cbVar,text="Check me",command=on_check)
- chbox.place(x=0,y=0)
- text = Label(root,text="This is a text",fg=off_color)
- text.place(x=0,y=50)
- mainloop()
Add Comment
Please, Sign In to add comment