Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from tkinter import *
- root = Tk()
- def buttonchange(button):
- if button["text"] == " ":
- button["text"] = "X"
- button = StringVar()
- btn1 = Button(text=" ", command=lambda:buttonchange(btn1))
- btn1.pack()
- btn2 = Button(text=" ", command=lambda:buttonchange(btn2))
- btn2.pack()
- if btn2["text"] == "X":
- print("This is a test.")
- root.mainloop()
- from tkinter import *
- root = Tk()
- def buttonchange(button):
- if button["text"] == " ":
- button["text"] = "X"
- print("This is a test.")
- button = StringVar()
- btn1 = Button(text=" ", command=lambda:buttonchange(btn1))
- btn1.pack()
- btn2 = Button(text=" ", command=lambda:buttonchange(btn2))
- btn2.pack()
- root.mainloop()
Add Comment
Please, Sign In to add comment