Ejemplo n.º 1
0
 def repaint(self, event: Event):
     # Draw something on the image
     ctx = DrawingContext(self.image)
     ctx.fill('#')
     text = "1234567890"
     for i in range(min(self.image.size.width, self.image.size.height)):
         ctx.fill(text[i % len(text)])
         ctx.clip_by(1, 1, -1, -1)
Ejemplo n.º 2
0
 def repaint(self, event: Event):
     # Draw something on the image
     ctx = DrawingContext(self.image)
     ctx.fill('#')
     text = "1234567890"
     for i in range(min(self.image.size.width, self.image.size.height)):
         ctx.fill(text[i % len(text)])
         ctx.clip_by(1, 1, -1, -1)
Ejemplo n.º 3
0
 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))
Ejemplo n.º 4
0
 def repaint(self, event: Event):
     # Draw something on the image
     ctx = DrawingContext(self.image)
     ctx.fill('.')
     title = "TextLand Demo Application"
     ctx.move_to((self.image.size.width - len(title)) // 2, 0)
     ctx.print(title)
     ctx.print('=' * len(title))
     ctx.move_to(0, 3)
     ctx.print("Type 'q' to quit")
     ctx.move_to(10, 10)
     ctx.print("Event: {}".format(event))
Ejemplo n.º 5
0
 def _paint_resize_msg(self, ctx: DrawingContext) -> None:
     text = "Please enlarge this window"
     ctx.move_to(
         (self.image.size.width - len(text)) // 2,
         self.image.size.height // 2)
     ctx.print(text)
Ejemplo n.º 6
0
 def repaint(self, event: Event) -> None:
     ctx = DrawingContext(self.image)
     if self.image.size.width < 65 or self.image.size.height < 18:
         self._paint_resize_msg(ctx)
     else:
         self._paint_color_table(ctx)
Ejemplo n.º 7
0
 def repaint(self, event: Event):
     # Draw something on the image
     ctx = DrawingContext(self.image)
     ctx.fill(' ')
     for y in range(self.image.size.height):
         ctx.move_to(0, y)
         if y % 10 == 0:
             ctx.print('---')
             if y > 0:
                 ctx.move_to(4, y)
                 ctx.print("{:-2d}".format(y))
         else:
             ctx.print('-')
     text = "TextLand Ruler"
     ctx.move_to(
         (self.image.size.width - len(text)) // 2,
         self.image.size.height // 2)
     ctx.print(text)
Ejemplo n.º 8
0
 def repaint(self, event: Event):
     ctx = DrawingContext(self.image)
     ctx.border()
Ejemplo n.º 9
0
 def repaint(self, event: Event):
     # Draw something on the image
     ctx = DrawingContext(self.image)
     title = "TextLand Cell Character Attribute and Colors Demo Application"
     ctx.move_to((self.image.size.width - len(title)) // 2, 0)
     ctx.print(title)
     ctx.print('=' * len(title))
     ctx.move_to(0, 3)
     ctx.attributes.fg = BRIGHT_GREEN
     ctx.attributes.bg = RED
     ctx.print("Type 'q' to quit")
     ctx.attributes.reset()
     ctx.move_to(10, 6)
     ctx.attributes.style = REVERSE
     ctx.print("REVERSE")
     ctx.move_to(10, 7)
     ctx.attributes.style = UNDERLINE
     ctx.print("UNDERLINE")
     ctx.move_to(10, 8)
     ctx.attributes.style = UNDERLINE | REVERSE
     ctx.print("BOTH")
Ejemplo n.º 10
0
 def repaint(self, event: Event):
     # Draw something on the image
     ctx = DrawingContext(self.image)
     ctx.fill(' ')
     for y in range(self.image.size.height):
         ctx.move_to(0, y)
         if y % 10 == 0:
             ctx.print('---')
             if y > 0:
                 ctx.move_to(4, y)
                 ctx.print("{:-2d}".format(y))
         else:
             ctx.print('-')
     text = "TextLand Ruler"
     ctx.move_to((self.image.size.width - len(text)) // 2,
                 self.image.size.height // 2)
     ctx.print(text)
Ejemplo n.º 11
0
 def repaint(self, event: Event):
     ctx = DrawingContext(self.image)
     ctx.border()