Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from tkinter import *
- root = Tk()
- def on_click(event):
- global cnt
- cnt += 1
- print('Hello!')
- if cnt == 2:
- t = event.widget
- t.unbind('<Button-1>')
- cnt = 0
- button1 = Button(width = 3, height = 3, bg = 'skyblue')
- button1.grid(row = 0, column = 0)
- button1.bind('<Button-1>', on_click)
- button2 = Button(width = 3, height = 3, bg = 'orange')
- button2.grid(row = 0, column = 1)
- button2.bind('<Button-1>', on_click)
- root.mainloop()
Advertisement
Add Comment
Please, Sign In to add comment