def render(self, surf): if self.shape == self.CIRCLE: circle(surf, self.pos, self.rad, self.color) elif self.shape == self.CROSS: line(surf, self.midleft, self.midright, self.color, 1) line(surf, self.midtop, self.midbottom, self.color, 1) else: raise NotImplementedError
def render(self, screen): for i in range(2, 4): line(screen, (100 * i, 100), (100 * i, 400), DARK, 8, ROUNDED) line(screen, (100, 100 * i), (400, 100 * i), DARK, 8, ROUNDED) for x in range(3): for y in range(3): if self.grid[x][y] == self.TIC: self.render_tic(screen, x, y) elif self.grid[x][y] == self.TOC: self.render_toc(screen, x, y) if self._hint and not self.won: if self.turn == self.TOC: self.render_toc(screen, *self._hint, True) else: self.render_tic(screen, *self._hint, True) won = self.is_won() if won == self.TIC: pos = 250, 250 ring(screen, pos, 125, 30, GREEN) if won == self.TOC: line(screen, (150, 150), (350, 350), RED, 30, ROUNDED) line(screen, (350, 150), (150, 350), RED, 30, ROUNDED)
def render_toc(self, screen, x, y, hint=False): xx = 100 * x yy = 100 * y pos1 = 120 + xx, 120 + yy pos2 = pos1[0] + 60, pos1[1] pos3 = pos1[0], pos1[1] + 60 pos4 = pos2[0], pos3[1] color = RED if hint or self.won: color = (149, 165, 166) line(screen, pos1, pos4, color, 12, ROUNDED) line(screen, pos2, pos3, color, 12, ROUNDED)
def render(self, surf): # self.structure[0].render(surf) # i points to the last element, as we start the enumaration at one. for elt in self.structure: # line(surf, # (self.left, self.structure[i].bottom), # (self.right, self.structure[i].bottom), # self.sep_color) elt.render(surf) # line(surf, # (self.left, self.structure[-1].bottom), # (self.right, self.structure[-1].bottom), # self.sep_color) line(surf, self.topright, self.bottomright, self.sep_color)
def render(self, display): """Render basicly the text.""" # to handle changing objects / callable if self.shawn_text != self._last_text: self._render() if self.text: papy = self._surface.get_width() if papy <= self.width: display.blit(self._surface, (self.topleft, self.size)) else: display.blit(self._surface, (self.topleft, self.size), ((papy - self.w, 0), self.size)) else: display.blit(self.default_text, (self.topleft, self.size)) if self._focus: groom = self.cursor_pos() line(display, (groom, self.top), (groom, self.bottom), CONCRETE)
def render(self, surf): line(surf, self.pos1, self.pos2, self.color, self.line_width)