Как поменять ввод правильных чисел на нажатие правильных кнопок (Tkinter)? (Изменён 16:46)

У меня есть 9 белых кнопок и поле для счёта (b12). Как правильно сделать, чтобы нам показывали не номера кнопок, а красили сами кнопки на время, и были правильны те кнопки, которые нам покрасили и только в той же последовательности.

Я уже долго мучаюсь и никак не успеваю в соло его доделать, помогите пожалуйста

root = Tk()
root.title("GAME!")
root.geometry("800x600")

clicks=0
o=9
p=1

def click_button():
    clicks += 1
    b12["text"] = f"Счёт {clicks}"

while p!=0:
    f=0
    while f==0:
        a = []
        while len(a)<p:
            a.append(str(random.randint(1, o)))
        print (a,end='')
        time.sleep(3)
        print('\r                                            ')
        input_str=input ('Введите последовательность, через запятую:')
        if input_str.split(",") == a:
            print('Угадали')
            f=1
            p+=1
        else:
            print("Не угодали")
            exit(0)

b1 = tk.Button(text="", command=click_button, bg="white")
b1.place(x=0, y=0, height=200, width=200)

b2 = tk.Button(text="", command=click_button, bg="white")
b2.place(x=200, y=0, height=200, width=200)
 
b3 = tk.Button(text="", command=click_button, bg="white")
b3.place(x=400, y=0, height=200, width=200)

b4 = tk.Button(text="", command=click_button, bg="white")
b4.place(x=0, y=200, height=200, width=200)

b5 = tk.Button(text="", command=click_button, bg="white")
b5.place(x=200, y=200, height=200, width=200)

b6 = tk.Button(text="", command=click_button, bg="white")
b6.place(x=400, y=200, height=200, width=200)

b7 = tk.Button(text="", command=click_button, bg="white")
b7.place(x=0, y=400, height=200, width=200)

b8 = tk.Button(text="", command=click_button, bg="white")
b8.place(x=200, y=400, height=200, width=200)
   
b9 = tk.Button(text="", command=click_button, bg="white")
b9.place(x=400, y=400, height=200, width=200)

b12 = ttk.Button(text="Счёт 0")
b12.place(x=600, y=0, height=75, width=200)

root.mainloop()

Ответы (0 шт):