Пример #1
0
    def update(self, val):
        max_angle = 135
        if val < self.min_val: angle = 45
        elif val > self.max_val: angle = max_angle
        else:
            angle = ((((val - self.min_val) / (self.max_val - self.min_val))) *
                     (max_angle - 45) + 45)

        top_point_x = self.mid - int(
            math.cos(math.radians(angle)) * self.length)
        top_point_y = int(math.sin(math.radians(angle)) * self.length)

        if self.outline:
            self.arrow = Triangle(self.pivot1[0],
                                  self.height,
                                  self.pivot2[0],
                                  self.height,
                                  top_point_x,
                                  self.height - top_point_y,
                                  fill=self.colour,
                                  outline=self.outline_colour)
        else:
            self.arrow = Triangle(self.pivot1[0],
                                  self.height,
                                  self.pivot2[0],
                                  self.height,
                                  top_point_x,
                                  self.height - top_point_y,
                                  fill=self.colour)
        super().pop()
        super().append(self.arrow)

        #need a better way of formatting this
        #and maybe shifting it to the right place here.
        self.data.text = self.value_label + str(int(val))
Пример #2
0
def draw_poly_using_triangle():

    t1 = Triangle(80, 10, 160, 10, 220, 220, fill=0xFF0000)
    t2 = Triangle(80, 10, 20, 220, 220, 220, fill=0xFF0000)
    polygon = displayio.Group(max_size=2)
    polygon.append(t1)
    polygon.append(t2)
    return polygon
Пример #3
0
    def triangle(self, x: int, y: int, r: int, color=COLORS.RED) -> None:
        """
        triangle function
        Draws a equilateral triangle with center in cordinates (x, y) and side
        size ``a``. Where ``a`` is equal to ``(6 x r) / √3``

                      (x0,y0)
                    /\
                   /  \
                  / .  \
                 / x, y \
         (x2,y2)/________\ (x1,y1)

        :param int x: x coordinate of the triangle center
        :param int y: y coordinate of the triangle center
        :param int r: r radius of the circle inside the triangle
        :param int color: color identification
        :return: None
        :rtype None
        """
        color_hex = COLORS.to_hex_color(color)
        # to simplify math we take the following approximation √3≈1.732
        square_three = 1.732
        r = r // 2
        x0 = x - int(round(square_three * r))
        y0 = y + r
        x1 = x
        y1 = y - int(round(square_three * 2 * r))
        x2 = x + int(round(square_three * r))
        y2 = y + r

        c = Triangle(x0, y0, x1, y1, x2, y2, fill=color_hex, outline=color_hex)
        self.group.append(c)
Пример #4
0
def show(up, down, left, right, robot, line1, line1highlight, line2,
         line2highlight):
    screen = displayio.Group(max_size=25)

    # define the controls
    rect = RoundRect(30, 30, 100, 68, 5, fill=0x0, outline=0xFFFFFF, stroke=1)
    screen.append(rect)

    if up:
        uptriangle = Triangle(80, 3, 44, 24, 116, 24, fill=0xADFF2F)
    else:
        uptriangle = Triangle(80, 3, 44, 24, 116, 24, outline=0x2F4F4F)
    screen.append(uptriangle)

    if down:
        downtriangle = Triangle(80, 125, 44, 103, 116, 103, fill=0xADFF2F)
    else:
        downtriangle = Triangle(80, 125, 44, 103, 116, 103, outline=0x2F4F4F)
    screen.append(downtriangle)

    if left:
        lefttriangle = Triangle(3, 64, 24, 40, 24, 86, fill=0xADFF2F)
    else:
        lefttriangle = Triangle(3, 64, 24, 40, 24, 86, outline=0x2F4F4F)
    screen.append(lefttriangle)

    if right:
        righttriangle = Triangle(157, 64, 134, 40, 134, 86, fill=0xADFF2F)
    else:
        righttriangle = Triangle(157, 64, 134, 40, 134, 86, outline=0x2F4F4F)
    screen.append(righttriangle)

    robot_name_text = label.Label(terminalio.FONT, text=robot, color=0xDC143C)
    robot_name_text.x = 65
    robot_name_text.y = 45
    screen.append(robot_name_text)

    if line1highlight:
        newline1 = "[{0}]".format(line1)
    else:
        newline1 = line1
    mode1_text = label.Label(terminalio.FONT, text=newline1, color=0xDCDCDC)
    mode1_text.x = 60
    mode1_text.y = 66
    screen.append(mode1_text)

    if line2highlight:
        newline2 = "[{0}]".format(line2)
    else:
        newline2 = line2
    mode2_text = label.Label(terminalio.FONT, text=newline2, color=0xC0C0C0)
    mode2_text.x = 65
    mode2_text.y = 83
    screen.append(mode2_text)

    display.show(screen)
Пример #5
0
def main():
    # Make the display context
    splash = displayio.Group(max_size=20)
    board.DISPLAY.show(splash)

    # Make a background color fill
    color_bitmap = displayio.Bitmap(320, 240, 1)
    color_palette = displayio.Palette(1)
    color_palette[0] = 0xFFFFFF
    bg_sprite = displayio.TileGrid(color_bitmap,
                                   x=0,
                                   y=0,
                                   pixel_shader=color_palette)
    splash.append(bg_sprite)
    ##########################################################################

    splash.append(Line(220, 130, 270, 210, 0xFF0000))
    splash.append(Line(270, 210, 220, 210, 0xFF0000))
    splash.append(Line(220, 210, 270, 130, 0xFF0000))
    splash.append(Line(270, 130, 220, 130, 0xFF0000))

    #Draw a blue star
    polygon = Polygon([(255, 40), (262, 62), (285, 62), (265, 76), (275, 100),
                       (255, 84), (235, 100), (245, 76), (225, 62), (248, 62)],
                      outline=0x0000FF)
    splash.append(polygon)

    triangle = Triangle(170,
                        50,
                        120,
                        140,
                        210,
                        160,
                        fill=0x00FF00,
                        outline=0xFF00FF)
    splash.append(triangle)

    rect = Rect(80, 20, 41, 41, fill=0x0)
    splash.append(rect)

    circle = Circle(100, 100, 20, fill=0x00FF00, outline=0xFF00FF)
    splash.append(circle)

    rect2 = Rect(50, 100, 61, 81, outline=0x0, stroke=3)
    splash.append(rect2)

    roundrect = RoundRect(10,
                          10,
                          61,
                          81,
                          10,
                          fill=0x0,
                          outline=0xFF00FF,
                          stroke=6)
    splash.append(roundrect)

    sleep(4)
    running = False
Пример #6
0
 def __init__(self, screen, xpos, ypos):
     screen.add(self)
     self.screen = screen
     self.xpos = xpos
     self.ypos = ypos
     self.val = 0
     self.count1 = 0
     self.count2 = 0
     self.blinkCount = 100
     self.blinkDirection = -2
     self.transparent = False
     self.xBound = 20
     self.yBound = 35
     self.rect = RoundRect(xpos - 6,
                           ypos - 8,
                           13,
                           16,
                           r=2,
                           outline=0xFFFFFF,
                           fill=None)
     screen.group.append(self.rect)
     self.tri1 = Triangle(self.xpos - 5,
                          self.ypos - 11,
                          self.xpos,
                          self.ypos - 16,
                          self.xpos + 6,
                          self.ypos - 11,
                          fill=0xFFFFFF)
     screen.group.append(self.tri1)
     self.tri2 = Triangle(self.xpos - 5,
                          self.ypos + 11,
                          self.xpos,
                          self.ypos + 16,
                          self.xpos + 6,
                          self.ypos + 10,
                          fill=0xFFFFFF)
     screen.group.append(self.tri2)
     self.label = Label(terminalio.FONT, text=self.val, max_glyphs=1)
     screen.group.append(self.label)
     bounding_box = self.label.bounding_box
     self.label.x = xpos - bounding_box[2] // 2 + 1
     self.label.y = ypos - 1
Пример #7
0
def draw_arc(centerpoint_x,
             centerpoint_y,
             length,
             start_x,
             end_x,
             num_sections,
             colour,
             height,
             colour_fade=False):
    triangles = []
    lastpoint = [
        start_x,
        int(
            math.sqrt(length * length - (centerpoint_x - start_x) *
                      (centerpoint_x - start_x)))
    ]
    increment = (end_x - start_x) / num_sections
    counter = 0
    for i in range(0, num_sections):
        if colour_fade: this_colour = colour[counter]
        else: this_colour = colour
        next_x = start_x + (i + 1) * increment
        nextpoint = [
            int(next_x),
            int(
                math.sqrt(length * length - (centerpoint_x - next_x) *
                          (centerpoint_x - next_x)))
        ]
        triangles.append(
            Triangle(lastpoint[0],
                     height - lastpoint[1],
                     lastpoint[0],
                     height - lastpoint[1],
                     nextpoint[0],
                     height - nextpoint[1],
                     outline=this_colour))
        lastpoint = nextpoint
        counter = counter + 1
    return triangles
Пример #8
0
def clock_hand(in_origin: Point, in_base: int, in_len: int,
               in_time_offset: float, in_color: int) -> Triangle:
    # build the second hand pointing upward (90 degrees) then rotate to point
    # toward the current second (negative angles)
    half_base = int(in_base / 2)
    a = Point(in_origin.x - half_base, in_origin.y)
    b = Point(in_origin.x + half_base, in_origin.y)
    c = Point(in_origin.x, in_origin.y - in_len)
    angle = 360.0 * in_time_offset / 60.0
    a.rotate(angle, in_origin)
    b.rotate(angle, in_origin)
    c.rotate(angle, in_origin)
    out_tri = Triangle(a.x,
                       a.y,
                       b.x,
                       b.y,
                       c.x,
                       c.y,
                       fill=in_color,
                       outline=in_color)
    print(out_tri)
    return out_tri
Пример #9
0
    def __init__(self, display, layout_json):
        self.json = layout_json
        if "view_type" not in layout_json:
            raise MissingTypeError
        if layout_json["view_type"] != "Triangle":
            raise IncorrectTypeError(
                "view_type '{}' does not match Layout Class 'Triangle'".format(
                    layout_json["view_type"]))
        self._display = display
        if "attributes" in layout_json:
            _missing_attrs = []
            for attribute in REQUIRED_ATTRIBUTES:
                if attribute not in layout_json['attributes']:
                    _missing_attrs.append(attribute)
            if len(_missing_attrs) > 0:
                raise MissingRequiredAttributesError(
                    "Missing required attributes: {}".format(_missing_attrs))

            _outline = 0xFFFFFF
            if "outline" in layout_json["attributes"]:
                _outline = int(layout_json["attributes"]["outline"], 16)

            _fill = 0x000000
            if "fill" in layout_json["attributes"]:
                _fill = int(layout_json["attributes"]["fill"], 16)

            _x0 = 0
            if "x0" in layout_json["attributes"]:
                _x0 = self.keyword_compiler(layout_json["attributes"]["x0"])

            _x1 = 0
            if "x1" in layout_json["attributes"]:
                _x1 = self.keyword_compiler(layout_json["attributes"]["x1"])

            _x2 = 0
            if "x2" in layout_json["attributes"]:
                _x2 = self.keyword_compiler(layout_json["attributes"]["x2"])

            _y0 = 0
            if "y0" in layout_json["attributes"]:
                _y0 = self.keyword_compiler(layout_json["attributes"]["y0"])

            _y1 = 0
            if "y1" in layout_json["attributes"]:
                _y1 = self.keyword_compiler(layout_json["attributes"]["y1"])

            _y2 = 0
            if "y2" in layout_json["attributes"]:
                _y2 = self.keyword_compiler(layout_json["attributes"]["y2"])

            self.triangle = Triangle(_x0,
                                     _y0,
                                     _x1,
                                     _y1,
                                     _x2,
                                     _y2,
                                     fill=_fill,
                                     outline=_outline)

            self.view = self.triangle
        else:
            raise MissingAttributesError()
        (265, 76),
        (275, 100),
        (255, 84),
        (235, 100),
        (245, 76),
        (225, 62),
        (248, 62),
    ],
    outline=0x0000FF,
)
splash.append(polygon)

triangle = Triangle(170,
                    50,
                    120,
                    140,
                    210,
                    160,
                    fill=0x00FF00,
                    outline=0xFF00FF)
splash.append(triangle)

rect = Rect(80, 20, 41, 41, fill=0x0)
splash.append(rect)

circle = Circle(100, 100, 20, fill=0x00FF00, outline=0xFF00FF)
splash.append(circle)

rect2 = Rect(50, 100, 61, 81, outline=0x0, stroke=3)
splash.append(rect2)

roundrect = RoundRect(10, 10, 61, 81, 10, fill=0x0, outline=0xFF00FF, stroke=6)
Пример #11
0
    def __init__(self,
                 min_val,
                 max_val,
                 width,
                 height,
                 base_size=8,
                 colour=0x0000FF,
                 outline_colour=0x0000FF,
                 outline=True,
                 bg_colour=0000000,
                 display_value=True,
                 value_label="",
                 arc_colour=0xFF0000,
                 colour_fade=False):
        super().__init__(max_size=20)
        self.pivot1 = [(width // 2) - (base_size // 2), 0]
        self.pivot2 = [(width // 2) + (base_size // 2), 0]
        self.mid = width // 2
        self.min_val = min_val
        self.max_val = max_val
        self.colour = colour
        self.height = height
        self.value_label = value_label
        self.outline_colour = outline_colour
        self.outline = outline

        self.length = int(1.4 * (width / 2))
        if outline:
            self.arrow = Triangle(self.pivot1[0],
                                  self.length,
                                  self.pivot2[0],
                                  self.length,
                                  self.mid,
                                  0,
                                  fill=self.colour,
                                  outline=self.outline_colour)
        else:
            self.arrow = Triangle(self.pivot1[0],
                                  self.length,
                                  self.pivot2[0],
                                  self.length,
                                  self.mid,
                                  0,
                                  fill=self.colour)

        self.data = Label(terminalio.FONT,
                          text="0.0",
                          color=0xFFFFFF,
                          max_glyphs=10)
        self.data.x = width // 2
        self.data.y = (height - self.length) // 2
        if display_value: super().append(self.data)

        arc = draw_arc(width // 2,
                       self.height,
                       self.length,
                       0,
                       width,
                       10,
                       arc_colour,
                       height,
                       colour_fade=colour_fade)
        for tri in arc:
            super().append(tri)
        super().append(self.arrow)
    def __init__(
        self,
        display,
        *,
        value_list=None,
        font=FONT,
        font_scale=1,
        color=0xFFFFFF,
        value=0,  # initial value, index into the value_list
        arrow_touch_padding=0,  # additional touch padding on the arrow sides of the Widget
        arrow_color=0x333333,
        arrow_outline=0x555555,
        arrow_height=30,
        arrow_width=30,
        arrow_gap=5,
        alt_touch_padding=0,  # touch padding on the non-arrow sides of the Widget
        horizontal=True,
        animation_time=None,
        cool_down=0.0,
        **kwargs,
    ):

        super().__init__(**kwargs, max_size=4)
        # Group elements for the FlipInput.
        # 0. The text
        # 1. The group holding the temporary scroll bitmap
        # 2. Up arrow: Triangle
        # 3. Down arrow: Triangle

        # initialize the Control superclass

        # pylint: disable=bad-super-call
        super(Control, self).__init__()

        self.value_list = value_list
        self._value = value

        self._color = color
        self._font = font
        self._font_scale = font_scale
        # preload the glyphs

        self._arrow_touch_padding = arrow_touch_padding
        self._alt_touch_padding = alt_touch_padding

        self._horizontal = horizontal
        self._display = display

        self._animation_time = animation_time
        self._cool_down = cool_down
        self._last_pressed = time.monotonic()
        self._pressed = False  # state variable

        # Find the maximum bounding box of the text and determine the
        # baseline (x,y) start point (top, left)

        left = None
        right = None
        top = None
        bottom = None

        for this_value in value_list:
            xposition = 0

            for i, character in enumerate(this_value):
                glyph = self._font.get_glyph(ord(character))

                if (
                    i == 0
                ):  # if it's the first character in the string, check the left value
                    if left is None:
                        left = glyph.dx
                    else:
                        left = min(left, glyph.dx)

                if right is None:
                    right = max(
                        xposition + glyph.dx + glyph.width, xposition + glyph.shift_x
                    )
                else:
                    right = max(
                        right,
                        xposition + glyph.dx + glyph.width,
                        xposition + glyph.shift_x,
                    )  # match bitmap_label

                if top is None:
                    top = -(glyph.height + glyph.dy)
                else:
                    top = min(top, -(glyph.height + glyph.dy))

                if bottom is None:
                    bottom = -glyph.dy
                else:
                    bottom = max(bottom, -glyph.dy)

                xposition = xposition + glyph.shift_x

        self._bounding_box = [
            0,
            0,
            (right - left) * self._font_scale,
            (bottom - top) * self._font_scale,
        ]

        # Create the text label
        self._label = bitmap_label.Label(
            text=value_list[value],
            font=self._font,
            scale=self._font_scale,
            color=self._color,
            base_alignment=True,
            background_tight=True,
        )
        self._label.x = -1 * left * self._font_scale
        self._label.y = -1 * top * self._font_scale

        self._left = left
        self._top = top

        self.append(self._label)  # add the label to the self Group

        # set the touch_boundary including the touch_padding
        self._arrow_gap = arrow_gap  # of pixel gap above/below label before the arrow

        if horizontal:  # horizontal orientation, add arrow padding to x-dimension and
            # alt_padding to y-dimension
            self.touch_boundary = [
                self._bounding_box[0]
                - self._arrow_gap
                - arrow_height
                - self._arrow_touch_padding,
                self._bounding_box[1] - self._alt_touch_padding,
                self._bounding_box[2]
                + 2 * (self._arrow_gap + arrow_height + self._arrow_touch_padding),
                self._bounding_box[3] + 2 * self._alt_touch_padding,
            ]
        else:  # vertical orientation, add arrow padding to y-dimension and
            # alt_padding to x-dimension
            self.touch_boundary = [
                self._bounding_box[0] - self._alt_touch_padding,
                self._bounding_box[1]
                - self._arrow_gap
                - arrow_height
                - self._arrow_touch_padding,
                self._bounding_box[2] + 2 * self._alt_touch_padding,
                self._bounding_box[3]
                + 2 * (self._arrow_gap + arrow_height + self._arrow_touch_padding),
            ]

        # create the Up/Down arrows
        self._update_position()  # call Widget superclass function to reposition

        self._animation_group = displayio.Group(
            max_size=1,
            scale=self._font_scale,
        )  # holds the animation bitmap
        # self._animation_group.x = -1 * left * (1)
        # self._animation_group.y = -1 * top * (1)
        self._animation_group.hidden = True
        self.append(self._animation_group)

        # Add the two arrow triangles, if required

        if (arrow_color is not None) or (arrow_outline is not None):

            if horizontal:  # horizontal orientation, add left and right arrows

                if (
                    (arrow_width is not None)
                    and (arrow_height is not None)
                    and (arrow_width > 0)
                ):
                    mid_point_y = self._bounding_box[1] + self._bounding_box[3] // 2
                    self.append(
                        Triangle(
                            self._bounding_box[0] - self._arrow_gap,
                            mid_point_y - arrow_height // 2,
                            self._bounding_box[0] - self._arrow_gap,
                            mid_point_y + arrow_height // 2,
                            self._bounding_box[0] - self._arrow_gap - arrow_width,
                            mid_point_y,
                            fill=arrow_color,
                            outline=arrow_outline,
                        )
                    )

                    self.append(
                        Triangle(
                            self._bounding_box[0]
                            + self._bounding_box[2]
                            + self._arrow_gap,
                            mid_point_y - arrow_height // 2,
                            self._bounding_box[0]
                            + self._bounding_box[2]
                            + self._arrow_gap,
                            mid_point_y + arrow_height // 2,
                            self._bounding_box[0]
                            + self._bounding_box[2]
                            + self._arrow_gap
                            + arrow_width,
                            mid_point_y,
                            fill=arrow_color,
                            outline=arrow_outline,
                        )
                    )
            else:  # vertical orientation, add upper and lower arrows

                if (
                    (arrow_height is not None)
                    and (arrow_width is not None)
                    and (arrow_height > 0)
                ):
                    mid_point_x = self._bounding_box[0] + self._bounding_box[2] // 2
                    self.append(
                        Triangle(
                            mid_point_x - arrow_width // 2,
                            self._bounding_box[1] - self._arrow_gap,
                            mid_point_x + arrow_width // 2,
                            self._bounding_box[1] - self._arrow_gap,
                            mid_point_x,
                            self._bounding_box[1] - self._arrow_gap - arrow_height,
                            fill=arrow_color,
                            outline=arrow_outline,
                        )
                    )
                    self.append(
                        Triangle(
                            mid_point_x - arrow_width // 2,
                            self._bounding_box[1]
                            + self._bounding_box[3]
                            + self._arrow_gap,
                            mid_point_x + arrow_width // 2,
                            self._bounding_box[1]
                            + self._bounding_box[3]
                            + self._arrow_gap,
                            mid_point_x,
                            self._bounding_box[1]
                            + self._bounding_box[3]
                            + self._arrow_gap
                            + arrow_height,
                            fill=arrow_color,
                            outline=arrow_outline,
                        )
                    )
Пример #13
0
tuile_image = TileGrid(page, pixel_shader=ColorConverter(),x=214,y=6)
groupe_BT_deconnecte.append(tuile_image)
groupe_principal.append(groupe_BT_deconnecte)

# Mise en place de l'image du logo Bluetooth en Mode connecté (caché)
groupe_BT_connecte = Group(max_size=1)
fichier = open("/images/Logo_BT_bleu.bmp", "rb")
page = OnDiskBitmap(fichier)
tuile_image = TileGrid(page, pixel_shader=ColorConverter(),x=214,y=6)
groupe_BT_connecte.append(tuile_image)
groupe_principal.append(groupe_BT_connecte)
groupe_principal[2].hidden = True

# Mise en place d'un groupe qui correspond au faisceau de la lampe
groupe_faisceau = Group(max_size = 3)
faisceau_lampe1 = Triangle(64, 53, 136, 126, 0, 71, fill=0x000000, outline=None)
groupe_faisceau.append(faisceau_lampe1)
faisceau_lampe2 = Triangle(136, 126, 72, 239, 0, 71, fill=0x000000, outline=None)
groupe_faisceau.append(faisceau_lampe2)
faisceau_lampe3 = Triangle(72, 239, 0, 239, 0, 71, fill=0x00000, outline=None)
groupe_faisceau.append(faisceau_lampe3)
groupe_principal.append(groupe_faisceau)

# Instanciation de la matrice de 64 LED Neopixels
eclairage = neopixel.NeoPixel(D8, 64, brightness=0.8)

# ---------------------------------------
# -------  BOUCLE PRINCIPALE  -----------
# ---------------------------------------
while True:
    # La carte CLUE s'annonce via des paquets d'advertising
Пример #14
0
    def draw_clock(self, x, y, radius, hour, minute):
        grp = displayio.Group(max_size=20, x=x, y=y)

        # Draw the clock outline.
        grp.append(
            Circle(radius,
                   radius,
                   radius,
                   outline=self.FOREGROUND_COLOR,
                   stroke=int(radius / 30)))

        # Draw the tick marks.
        for i in range(12):
            dx = math.sin(i / 12 * 2 * math.pi)
            dy = math.cos(i / 12 * 2 * math.pi)
            grp.append(
                Line(int(radius + radius * 0.85 * dx),
                     int(radius - radius * 0.85 * dy),
                     int(radius + radius * 0.95 * dx),
                     int(radius - radius * 0.95 * dy), self.FOREGROUND_COLOR))

        # Draw the hour hand.
        hour_angle = (hour * 60 + minute) / 60 / 12 * 2 * math.pi
        hx = math.sin(hour_angle)
        hy = math.cos(hour_angle)
        grp.append(
            Polygon([
                (int(radius + radius * 0.66 * hx),
                 int(radius - radius * 0.66 * hy)),
                (int(radius + radius * 0.07 * hy),
                 int(radius + radius * 0.07 * hx)),
                (int(radius - radius * 0.15 * hx),
                 int(radius + radius * 0.15 * hy)),
                (int(radius - radius * 0.07 * hy),
                 int(radius - radius * 0.07 * hx)),
            ],
                    outline=self.FOREGROUND_COLOR))

        # Draw the minute hand.
        minute_angle = minute / 60 * 2 * math.pi
        mx = math.sin(minute_angle)
        my = math.cos(minute_angle)
        grp.append(
            Triangle(int(radius + radius * 0.92 * mx),
                     int(radius - radius * 0.92 * my),
                     int(radius + radius * 0.05 * my),
                     int(radius + radius * 0.05 * mx),
                     int(radius - radius * 0.05 * my),
                     int(radius - radius * 0.05 * mx),
                     fill=self.FOREGROUND_COLOR))
        grp.append(
            Triangle(int(radius - radius * 0.15 * mx),
                     int(radius + radius * 0.15 * my),
                     int(radius + radius * 0.05 * my),
                     int(radius + radius * 0.05 * mx),
                     int(radius - radius * 0.05 * my),
                     int(radius - radius * 0.05 * mx),
                     fill=self.FOREGROUND_COLOR))

        # Draw the pin in the center.
        grp.append(
            Circle(radius,
                   radius,
                   int(radius * 0.03),
                   fill=self.BACKGROUND_COLOR,
                   outline=self.FOREGROUND_COLOR,
                   stroke=1))

        self._frame.append(grp)
Пример #15
0
        (265, 76),
        (275, 100),
        (255, 84),
        (235, 100),
        (245, 76),
        (225, 62),
        (248, 62),
    ],
    outline=0x000000,
)
splash.append(polygon)

triangle = Triangle(170,
                    20,
                    140,
                    90,
                    210,
                    100,
                    fill=0x999999,
                    outline=0x000000)
splash.append(triangle)

rect = Rect(80, 20, 41, 41, fill=0x999999, outline=0x666666)
splash.append(rect)

circle = Circle(100, 100, 20, fill=0xFFFFFF, outline=0x000000)
splash.append(circle)

rect2 = Rect(70, 85, 61, 30, outline=0x0, stroke=3)
splash.append(rect2)

roundrect = RoundRect(10,