игра для класса

Zack

Новичок
Пользователь
Апр 23, 2020
3
0
1
from tkinter import *
from tkinter import messagebox
root = Tk()
a=0

def message_1():
messagebox.askyesno(title="Вопрос", message="когда создали первый автомобиль?")

def message_2():
messagebox.askyesno(title="Вопрос", message="к")
def message_3():
messagebox.askyesno(title="Вопрос", message="а")
def message_4():
messagebox.askyesno(title="Вопрос", message="к")

def key(event):
if event.char == 'z' or event.char == 'я':
print('+10 красным')
if event.char == 'x' or event.char == 'ч':
print('+10 синим')
print ("pressed", repr(event.char))


labe1 = Label(root, text="География").place(x = 10, y = 10)
labe2 = Label(root, text="asd2").place(x = 10, y = 130)
labe3 = Label(root, text="asd3").place(x = 10, y = 250)
labe4 = Label(root, text="asd4").place(x = 10, y = 370)
labe5 = Label(root, text="asd5").place(x = 10, y = 490)
labe6 = Label(root, text="asd6").place(x = 10, y = 610)


b11 = Button(root, text = 'Ans11', command = message_1).place(x = 75, y = 10, width = 150, height = 120)
b11 = Button(root, text = "Ans12", command = message_2).place(x = 75, y = 130, width = 150, height = 120)
b11 = Button(root, text = "Ans13", command = message_3).place(x = 75, y = 250, width = 150, height = 120)
b11 = Button(root, text = "Ans14", command = message_4).place(x = 75, y = 370, width = 150, height = 120)
b11 = Button(root, text = "Ans15", command = message_4).place(x = 75, y = 490, width = 150, height = 120)
b11 = Button(root, text = "Ans16", command = message_4).place(x = 75, y = 610, width = 150, height = 120)
b11 = Button(root, text = 'Ans11', command = message_1).place(x = 225, y = 10, width = 150, height = 120)
b11 = Button(root, text = "Ans12", command = message_2).place(x = 225, y = 130, width = 150, height = 120)
b11 = Button(root, text = "Ans13", command = message_3).place(x = 225, y = 250, width = 150, height = 120)
b11 = Button(root, text = "Ans14", command = message_4).place(x = 225, y = 370, width = 150, height = 120)
b11 = Button(root, text = "Ans15", command = message_4).place(x = 225, y = 490, width = 150, height = 120)
b11 = Button(root, text = "Ans16", command = message_4).place(x = 225, y = 610, width = 150, height = 120)
b11 = Button(root, text = 'Ans11', command = message_1).place(x = 500, y = 10, width = 150, height = 120)
b11 = Button(root, text = "Ans12", command = message_2).place(x = 675, y = 130, width = 150, height = 120)
b11 = Button(root, text = "Ans13", command = message_3).place(x = 675, y = 250, width = 150, height = 120)
b11 = Button(root, text = "Ans14", command = message_4).place(x = 675, y = 370, width = 150, height = 120)
b11 = Button(root, text = "Ans15", command = message_4).place(x = 675, y = 490, width = 150, height = 120)
b11 = Button(root, text = "Ans16", command = message_4).place(x = 675, y = 610, width = 150, height = 120)






root.bind("<Key>", key)
##root.bind("<Button-1>", callback)

root.mainloop()
вот код
я забиндил горячие клавиши чтобы писалось например +10 красных
мне надо чтобы количество нажатий считалось
то есть пять кнопок
+10 +20 +30 +40 +50
и чтоб каждая кнопка считалась и подсчитывались баллы
 

Student

throw exception
Команда форума
Администратор
Апр 2, 2020
195
103
43
Москва
Оформите вопрос правильно: https://itfy.org/threads/kak-pravilno-sostavit-vopros-i-ne-poluchit-ban.1/
Иначе вопрос будет удален.
 

Форум IT Специалистов