it's my first post here. I'm trying to create a 5x5 table with random numbers. The goal is that the user is supposed to click from the smallest to biggest number on the table, and once he clicked correct one it should be disabled. I don't want to attach each button to variable. I've created windows with random number, but now I'd like to create function which would check if the clicked number is the smallest, and if the answer is yes I have to change it's state to DISABLED. I been sitting on this for over 4 hours and I have no idea how to access clicked button information like 'text', and how can I disable it after user clicks on it.
Here's what I got so far, working on dat function.
from tkinter import *
import random
def click(z=None):
global o
Button(state=DISABLED)
o=Tk()
y=0
listrow=[4,3,2,1,0]
numbers=[]
spr=IntVar()
while len(numbers) < 25:
r = random.randint(0,999)
if r not in numbers:
numbers.append(r)
for i in range(1,26):
Button(o, text=str(numbers[i-1]), width=10).grid(row=listrow[i%5], column=y)
if i == 5:
y+=1
elif i == 10:
y+=1
elif i==15:
y+=1
elif i==20:
y+=1
else:
continue
o.bind_all('<Button-1>', click)
o.mainloop()