from tkinter import*
from random import*
def vvod():
n=int(t.get())
m1.config(text="|"*n,font=("Arial Black",30))
m3=Label(w,text=n,font=("Arial Black",30))
m3.pack()
t.delete(0,END)
def player1():
n=int(t.get())
g=int(t1.get())
if (g==1) or (g==2) or (g==3) and n>g:
n.config(n-g)
m3['text']=n
m2['text']="|"*n
m1['text']="Вы можете тянуть 1-3 палочки"
m1['fg']="black"
else:
m1['text']="Ошибка"
m1['fg']="red"
if n==1:
m1['text']="Выиграл игрок 1"
m1['fg']="red"
b1["state"]=DISABLED
b2["state"]=ACTIVE
vvod()
def player2():
n=int(t.get())
g=int(t1.get())
if ((g==1) or (g==2) or (g==3)) and n>g:
n.config(n-g)
m3['text']=n
m2['text']="|"*n
m1['text']="Вы можете тянуть 1-3 палочки"
m1['fg']="black"
else:
m1['text']="Ошибка"
m1['fg']="red"
if n==1:
m1['text']="Выиграл игрок 2"
m1['fg']="red"
b2["state"]=DISABLED
b1["state"]=ACTIVE
vvod()
w=Tk()
m1=Label(w,text="Введите количество палочек",font=("Arial Black",14))
t=Entry(w,font=("Arial Black",30),width=12)
t1=Entry(w,font=("Arial Black",30),width=12)
m4=Label(w,text="Вы можете тянуть 1-3 палочки",font=("Arial Black",14))
b1=Button(w,text="Ход игрока 1",font=("Arial Black",30),width=12,bg="aqua",command=player1)
b2=Button(w,text="Ход игрока 2",font=("Arial Black",30),width=12,bg="pink",command=player2)
b3=Button(w,text="Начать заново",font=("Arial Black",30),width=12,bg="red")
b4=Button(w,text="Ввести количество палочек",font=("Arial Black",15),width=24,bg="green",command=vvod)
m1.pack()
t.pack()
m4.pack()
t1.pack()
b1.pack()
b2.pack()
b3.pack()
b4.pack()
line 1892, in __call__
return self.func(*args)
File line 13, in player1
n.config(n-g)
AttributeError: 'int' object has no attribute 'config'
from tkinter import*
from random import*
def player1():
n=int(t.get())
if ((eval(t1.get())==1) or (eval(t1.get())==2) or (eval(t1.get())==3)) and g>eval(t1.get()):
n=n-eval(t1.get())
m3['text']=g
m2['text']="|"*g
m1['text']="Вы можете тянуть 1-3 палочки"
m1['fg']="black"
else:
m1['text']="Ошибка"
m1['fg']="red"
if g==1:
m1['text']="Выиграл игрок 1"
m1['fg']="red"
b1["state"]=DISABLED
b2["state"]=ACTIVE
def player2():
n=int(t.get())
if ((eval(t1.get())==1) or (eval(t1.get())==2) or (eval(t1.get())==3)) and g>eval(t1.get()):
n=n-eval(t1.get())
m3['text']=g
m2['text']="|"*g
m1['text']="Вы можете тянуть 1-3 палочки"
m1['fg']="black"
else:
m1['text']="Ошибка"
m1['fg']="red"
if g==1:
m1['text']="Выиграл игрок 2"
m1['fg']="red"
b2["state"]=DISABLED
b1["state"]=ACTIVE
w=Tk()
m1=Label(w,text="Введите количество палочек",font=("Arial Black",14))
t=Entry(w,font=("Arial Black",30),width=12)
m2=Label(w,text="|"*n,font=("Arial Black",30))
m3=Label(w,text=n,font=("Arial Black",30))
t1=Entry(w,font=("Arial Black",30),width=12)
m4=Label(w,text="Вы можете тянуть 1-3 палочки",font=("Arial Black",14))
b1=Button(w,text="Ход игрока 1",font=("Arial Black",30),width=12,bg="aqua",command=player1)
b2=Button(w,text="Ход игрока 2",font=("Arial Black",30),width=12,bg="pink",command=player2)
b3=Button(w,text="Начать заново",font=("Arial Black",30),width=12,bg="red")
m1.pack()
t.pack()
m2.pack()
m3.pack()
m4.pack()
t1.pack()
b1.pack()
b2.pack()
b3.pack()
m2=Label(w,text="|"*n,font=("Arial Black",30))
NameError: name 'n' is not defined