Guest User

Untitled

a guest
Aug 14th, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. from tkinter import *
  2. root = Tk()
  3. off_color = "red"
  4. on_color = "green"
  5. def on_check():
  6. if cbVar.get() == "1":text["fg"] = on_color
  7. else:text["fg"] = off_color
  8. cbVar = StringVar(root)
  9. cbVar.set(0)
  10. chbox = Checkbutton(root,variable = cbVar,text="Check me",command=on_check)
  11. chbox.place(x=0,y=0)
  12. text = Label(root,text="This is a text",fg=off_color)
  13. text.place(x=0,y=50)
  14. mainloop()
Add Comment
Please, Sign In to add comment