Я внедряю текст в свой код, чтобы я точно говорил пользователю, что происходит, но, похоже, возникают проблемы с отображением текста на дисплее pygame, особенно когда я его вызываю.
Я уже пробовал различные способы отображения текста в окне pygame, и оно, похоже, не работает.
class maze (): def init (self, new): self.new = new self.walls = [] self.lab_walls = [] self.cells = []
a = 0
v = 0
for q in range(23):
for r in range(39):
deed = q in (0,1,2) and r > 60
if not deed:
self.cells.append(cell((a + 8, v, 25,8), (a + 8, v + 33, 25, 8), (a, v + 8, 8 ,25), (a + 33, v + 8, 8, 25)))
a += 33
a = 0
v += 33
for w in self.cells[0].walls:
self.lab_walls.append(w)
self.walls.append(w)
self.cells[0].view = True
while len(self.walls) > 0:
bounds = random.choice(self.walls)
divcells = []
for p in self.cells:
if bounds in p.walls:
divcells.append(p)
if len(divcells) > 1 and (not ((divcells[0].view and divcells[1].view) or ((not divcells[0].view) and (not divcells[1].view)))):
for g in divcells:
g.walls.remove(bounds)
if g.view == False:
g.view = True
for o in g.walls:
if not o in self.walls:
self.walls.append(o)
if not o in self.lab_walls:
self.lab_walls.append(o)
if bounds in self.lab_walls:
self.lab_walls.remove(bounds)
self.walls.remove(bounds)
for j in range(0, 789, 33):
for i in range(0, 1290, 33):
self.lab_walls.append((i, j, 8, 8))
def draw(self, win):
displaysurf.fill(WHITE)
for g in self.lab_walls:
pygame.draw.rect(displaysurf, BLACK, pygame.Rect(g[0], g[1], g[2], g[3]))
pygame.draw.rect(displaysurf, PURPLE, win)
Предполагается, что текст должен отображаться в окне пигмея, но кроме фона ничего не отображается.