Ejemplo n.º 1
0
def clock(image, scale, annotator=None, world=None, **kw):
    d = ImageDraw.Draw(image)
    bounds = (0, 0, image.width, image.height)
    text = annotate.ImageText(time.strftime("%H:%m:%S"),
                              position=annotate.AnnotationPosition.TOP_LEFT,
                              outline_color="black")
    text.render(d, bounds)
Ejemplo n.º 2
0
 def print_line(text_line):
     text = annotate.ImageText(
         text_line,
         position=annotate.AnnotationPosition.TOP_LEFT,
         outline_color='black',
         color='lightblue')
     text.render(d, bounds)
     TEXT_HEIGHT = 11
     bounds[1] += TEXT_HEIGHT
Ejemplo n.º 3
0
    def apply(self, image, scale):
        d = ImageDraw.Draw(image)
        bounds = (0, 0, image.width, image.height)

        if not self.battery_state_task:
            self.battery_state_task = self.world.robot.get_battery_state()

        if asyncio.isfuture(
                self.battery_state_task) and self.battery_state_task.done():
            self.battery_state = self.battery_state_task.result()
            self.battery_state_task = self.world.robot.get_battery_state()

        if self.battery_state:
            batt = self.battery_state.battery_volts
            text = annotate.ImageText(f"BATT {batt:.1f}v",
                                      color="green",
                                      outline_color="black")
            text.render(d, bounds)