| 3 | from tkinter import Tk, Button, DISABLED |
| 4 | |
| 5 | def show_symbol(x,y): |
| 6 | global first |
| 7 | global previousx, previousy |
| 8 | buttons[x,y]['text'] = button_symbols[x,y] |
| 9 | buttons[x,y].update_idletasks() |
| 10 | |
| 11 | if first: |
| 12 | previousx = x |
| 13 | previousy = y |
| 14 | first = False |
| 15 | elif previousx != x or previousy !=y: |
| 16 | if buttons[previousx, previousy]['text'] != buttons[x,y]['text']: |
| 17 | time.sleep(0.5) |
| 18 | buttons[previousx,previousy]['text']= ' ' |
| 19 | buttons[x,y]['text'] = ' ' |
| 20 | else: |
| 21 | buttons[previousx, previousy]['command'] = DISABLED |
| 22 | buttons[x,y]['command'] = DISABLED |
| 23 | first = True |
| 24 | |
| 25 | win = Tk() |
| 26 | win.title('Matchmaker') |