NameError: name 'text' is not defined
Я начал делать игру, где будут 9 кнопок и только 1 кнопка будет правильной. Правильные кнопки будут меняться и при нажатии неправильной кнопки счёт будет сбрасываться. В итоге при создании игры произошла(и) ошибки
Traceback (most recent call last):
File "C:/Users/User/Desktop/Game.py", line 25, in <module>
tr = text(text=str(n)+'$', font=('Helvetica 100'))
NameError: name 'text' is not defined
from tkinter import *
clicks = 0
root = Tk()
root.title('Game')
root.geometry('720x1280')
def click_button():
global clicks
clicks = clicks + 1
root.title("Clicks {}".format(clicks))
label['text'] = str(n) + '$'
but_1 = Button(text='1', width=3, height=1, bg='blue', font='Hack 30', command=click_button)
but_2 = Button(text='2', width=3, height=1, bg='green', font='Hack 30', command=click_button)
but_3 = Button(text='3', width=3, height=1, bg='red', font='Hack 30', command=click_button)
but_4 = Button(text='4', width=3, height=1, bg='yellow', font='Hack 30', command=click_button)
but_5 = Button(text='5', width=3, height=1, bg='orange', font='Hack 30', command=click_button)
but_6 = Button(text='6', width=3, height=1, bg='brown', font='Hack 30', command=click_button)
but_7 = Button(text='7', width=3, height=1, bg='violet', font='Hack 30', command=click_button)
but_8 = Button(text='8', width=3, height=1, bg='grey', font='Hack 30', command=click_button)
but_9 = Button(text='9', width=3, height=1, bg='pink', font='Hack 30', command=click_button)
tr = text(text=str(n)+'$', font=('Helvetica 100'))
tr.pack()
but_1.place(x=210, y=240)
but_2.place(x=310, y=240)
but_3.place(x=410, y=240)
but_4.place(x=210, y=340)
but_5.place(x=310, y=340)
but_6.place(x=410, y=340)
but_7.place(x=210, y=440)
but_8.place(x=310, y=440)
but_9.place(x=410, y=440)
tr.place(x=100, y=110)
root.mainloop()