-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
48 lines (37 loc) · 1.38 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import tkinter as tk
from tkinter.messagebox import showinfo
from src.akifood import Game
from src.models import DishAdjective, Dish
DISHES = [
Dish(name='Lasanha', dish_adjectives_id=[1]),
Dish(name='Bolo de chocolate', dish_adjectives_id=[])
]
ADJECTIVES = [
DishAdjective(_id=1, name='massa')
]
def start(root):
game = Game(root)
success, game_adjectives, dish_attempt = game.get_user_answers(DISHES,
ADJECTIVES)
if success:
showinfo('Ganhei!', 'Acertei de novo!')
if not success:
dish_name = game.get_dish_name()
new_dish_adjective_name = game.get_new_adjective(
dish_name, dish_attempt)
new_dish_adjective = game.create_dish_adjective(
game.next_adjective_id(ADJECTIVES), new_dish_adjective_name)
game_adjectives.append(new_dish_adjective._id)
ADJECTIVES.append(new_dish_adjective)
new_dish = game.create_dish(dish_name, game_adjectives)
DISHES.append(new_dish)
if __name__ == '__main__':
root = tk.Tk()
root.eval('tk::PlaceWindow . center')
root.geometry('300x100')
root.title('Jogo Gourmet')
label = tk.Label(root, text='Pense em um prato que gosta.', pady=20)
button = tk.Button(root, text='Ok', command=lambda: start(root), padx=25)
label.pack()
button.pack()
root.mainloop()