def _paint_color_table(self, ctx: DrawingContext) -> None: CELL_WIDTH = 4 NUM_COLORS = 16 for fg in range(NUM_COLORS): for bg in range(NUM_COLORS): ctx.attributes.reset() ctx.border( 0, self.image.size.width - (NUM_COLORS * CELL_WIDTH) - 1, 0, self.image.size.height - NUM_COLORS - 2) ctx.move_to(1 + fg * CELL_WIDTH, 1 + bg) ctx.attributes.fg = fg ctx.attributes.bg = bg ctx.print("{:X}+{:X}".format(fg, bg))
def repaint(self, event: Event): ctx = DrawingContext(self.image) ctx.border()