MCPcopy Create free account
hub / github.com/AdaCompNUS/summit / __init__

Method __init__

PythonAPI/examples/automatic_control.py:360–372  ·  view source on GitHub ↗
(self, font, width, height)

Source from the content-addressed store, hash-verified

358
359class HelpText(object):
360 def __init__(self, font, width, height):
361 lines = __doc__.split('\n')
362 self.font = font
363 self.dim = (680, len(lines) * 22 + 12)
364 self.pos = (0.5 * width - 0.5 * self.dim[0], 0.5 * height - 0.5 * self.dim[1])
365 self.seconds_left = 0
366 self.surface = pygame.Surface(self.dim)
367 self.surface.fill((0, 0, 0, 0))
368 for n, line in enumerate(lines):
369 text_texture = self.font.render(line, True, (255, 255, 255))
370 self.surface.blit(text_texture, (22, n * 22))
371 self._render = False
372 self.surface.set_alpha(220)
373
374 def toggle(self):
375 self._render = not self._render

Callers

nothing calls this directly

Calls 1

renderMethod · 0.45

Tested by

no test coverage detected