import random
from tkinter import *
textgame = "Давай играть! Выбирай:\nКамень,\nНожницы,\nБумага.\n"
def check(choice):
choiceC = random.choice(['Камень', 'Ножницы', 'Бумага'])
if choice == "Камень" and choiceC == "Ножницы":
win(choiceC)
if choice == "Ножницы" and choiceC == "Бумага":
win(choiceC)
if choice == "Бумага" and choiceC == "Камень":
win(choiceC)
if choice == "Камень" and choiceC == "Бумага":
lose(choiceC)
if choice == "Ножницы" and choiceC == "Камень":
lose(choiceC)
if choice == "Бумага" and choiceC == "Ножницы":
lose(choiceC)
if choice == choiceC:
lblr['text'] = choiceC + "." + " Ничья!"
def win(choiceC):
lblr['text'] = choiceC + "." + " Вы победили!"
def lose(choiceC):
lblr['text'] = choiceC + "." + " Вы проиграли!"
window = Tk()
window.title("Rock, scissors, paper with graphics")
window.geometry('400x250')
lbl = Label(window, text=textgame, font=("Arial Bold", 15))
lbl.grid(column=1, row=0)
btnr = Button(window, text="Камень", command=lambda: check('Камень'))
btnr.grid(column=0, row=1)
btns = Button(window, text="Ножницы", command=lambda: check('Ножницы'))
btns.grid(column=1, row=1)
btnp = Button(window, text="Бумага", command=lambda: check('Бумага'))
btnp.grid(column=2, row=1)
lblr = Label(window, text="test", font=("Arial Bold", 15))
lblr.grid(column=1, row=2)
window.mainloop()