Guest User

Untitled

a guest
Feb 16th, 2019
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. from tkinter import *
  2. root = Tk()
  3. def buttonchange(button):
  4. if button["text"] == " ":
  5. button["text"] = "X"
  6. button = StringVar()
  7. btn1 = Button(text=" ", command=lambda:buttonchange(btn1))
  8. btn1.pack()
  9. btn2 = Button(text=" ", command=lambda:buttonchange(btn2))
  10. btn2.pack()
  11. if btn2["text"] == "X":
  12. print("This is a test.")
  13. root.mainloop()
  14.  
  15. from tkinter import *
  16. root = Tk()
  17. def buttonchange(button):
  18. if button["text"] == " ":
  19. button["text"] = "X"
  20. print("This is a test.")
  21.  
  22. button = StringVar()
  23. btn1 = Button(text=" ", command=lambda:buttonchange(btn1))
  24. btn1.pack()
  25. btn2 = Button(text=" ", command=lambda:buttonchange(btn2))
  26. btn2.pack()
  27.  
  28. root.mainloop()
Add Comment
Please, Sign In to add comment