board.py 611 Bytes
Newer Older
Fedrico Otaran's avatar
Fedrico Otaran committed
1
2
import PySimpleGUI as sg

3
4

def build(player_1, player_2, board_data):
5
6
7
    """
    Construye la ventana del tablero del juego
    """
Fedrico Otaran's avatar
Fedrico Otaran committed
8
    layout = [
9
10
11
        [sg.Text("Jugador 1: " + player_1["name"], key="-P1-", text_color="darkblue")],
        [sg.Text("Jugador 2: " + player_2["name"], key="-P2-", text_color="white")],
        [sg.Text("")],
Fedrico Otaran's avatar
Fedrico Otaran committed
12
13
14
15
    ]

    for y in range(3):
        layout += [
16
17
18
19
            [
                sg.Button(board_data[x][y], size=(8, 4), key=f"cell-{x}-{y}")
                for x in range(3)
            ]
Fedrico Otaran's avatar
Fedrico Otaran committed
20
21
        ]

22
    board = sg.Window("Ta Te Ti").Layout(layout)
Fedrico Otaran's avatar
Fedrico Otaran committed
23
24

    return board