desenhar mapa numa ciaxa de dialogo
This commit is contained in:
@ -1,24 +1,33 @@
|
||||
import tkinter as tk
|
||||
from tkinter import ttk
|
||||
|
||||
from modules.mapa import Mapa
|
||||
|
||||
|
||||
class Frame_Mapa(ttk.Frame):
|
||||
def __init__(self, dimensao: tuple[int, int]):
|
||||
self.n_linhas = dimensao[0]
|
||||
self.n_colunas = dimensao[1]
|
||||
def __init__(self, mapa: Mapa):
|
||||
super().__init__()
|
||||
self.n_linhas: int = mapa.dimensao[0]
|
||||
self.n_colunas: int = mapa.dimensao[1]
|
||||
for grid_y in range(0, self.n_linhas):
|
||||
for grid_x in range(0, self.n_colunas):
|
||||
tmp_label = tk.Label(self, text="0")
|
||||
tmp_label.grid(column=grid_x, row=grid_y)
|
||||
|
||||
|
||||
class App(tk.Tk):
|
||||
def __init__(self) -> None:
|
||||
def __init__(self, mapa: Mapa) -> None:
|
||||
super().__init__()
|
||||
# titulo e icone
|
||||
self.title('Game Theory of Life')
|
||||
self.iconbitmap()
|
||||
# definir frames dentro da janela principal
|
||||
self.frame_mapa = Frame_Mapa((10, 10))
|
||||
self.frame_mapa = Frame_Mapa(mapa)
|
||||
self.frame_mapa.grid(row=0, column=0)
|
||||
# iniciar janela da aplicação
|
||||
self.mainloop()
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
app = App()
|
||||
mapa_mundo: Mapa = Mapa((10, 10))
|
||||
app = App(mapa_mundo)
|
||||
|
||||
Reference in New Issue
Block a user