from tkinter import *
import random
from tkinter import Label
root = Tk()
root.title("камень ножницы бумага")
root.config(background='white')
root.geometry('600x300')
root.resizable(width=False, height=False)
labelText = Label(root, text='', fg='black', font=('Times New Roman', 20), bg='white')
labelText.place(y=400, x=200)
lbl = Label(root, text='СЧЁТ:', fg='black', font=('Times New Roman', 20), bg='white')
lbl.place(y=180, x=260)
def knb(player_choice):
ResUser = 0
ResPc = 0
computer_choice = random.choice(['камень', 'ножницы', 'бумага'])
if computer_choice == player_choice:
labelText.config(text=f'{computer_choice} vs {computer_choice}, ничья')
elif computer_choice == 'камень' and player_choice == 'бумага':
labelText.config(text=f'{player_choice} vs {computer_choice}, Вы выиграли!')
ResUser += 1
elif computer_choice == 'бумага' and player_choice == 'камень':
labelText.config(text=f'{player_choice} vs {computer_choice}, Выиграл компьютер:(')
ResPc += 1
elif computer_choice == 'камень' and player_choice == 'ножницы':
labelText.config(text=f'{player_choice} vs {computer_choice}, Выиграл компьютер:(')
ResPc += 1
elif computer_choice == 'ножницы' and player_choice == 'камень':
labelText.config(text=f'{player_choice} vs {computer_choice}, Вы выиграли!')
ResUser += 1
elif computer_choice == 'ножницы' and player_choice == 'бумага':
labelText.config(text=f'{player_choice} vs {computer_choice}, Выиграл компьютер:(')
ResPc += 1
elif computer_choice == 'бумага' and player_choice == 'ножницы':
labelText.config(text=f'{player_choice} vs {computer_choice}, Вы выиграли!')
ResUser += 1
lb = Label(root, text=f'Вы:{ResUser}-Компьютер:{ResPc}', fg='black', font=('Times New Roman', 20), bg='white')
lb.place(y=220, x=185)
labelText.pack()
stone = Button(root,
text='камень',
font=('Times New Roman', 15),
bg='white',
command=lambda: knb('камень')
)
stone.place(x=50, y=300)
stone.pack()
scissors = Button(root,
text='ножницы',
font=('Times New Roman', 15),
bg='white',
command=lambda: knb('ножницы')
)
scissors.pack()
paper = Button(root,
text='бумага',
font=('Times New Roman', 15),
bg='white',
command=lambda: knb('бумага')
)
paper.pack()
root.mainloop()