Verteiltesystheme/Code/UI/Field.py

27 lines
769 B
Python

from Code.Config import GeneralConfig, SquareConfig
import math
from Code.UI import Square
from Code.UI.Square import Square
class Field:
def __init__(self):
self.width = math.trunc(GeneralConfig.width / SquareConfig.width)
self.height = math.trunc(GeneralConfig.height / SquareConfig.height)
self.squares = self._creat_squares()
def _creat_squares(self):
squares = [[Square(x_pos=j * SquareConfig.width, y_pos=i * SquareConfig.height) for i in range(self.height)] for
j in range(self.width)]
print(squares)
return squares
def update_squares(self):
pass
def draw_squares(self, window):
for x in self.squares:
for y in x:
y.draw(window)