Exemple #1
0
    def __init__(self, points=None, width=1., color=None, alpha=1., **kwargs):
        super().__init__(**kwargs)

        self._color = KivyColor(rgb=color or OFFWHITE, a=alpha)
        self._shape = KivyLine(
            points=points,
            width=width,
        )

        self.add(self._color)
        self.add(self._shape)
Exemple #2
0
    def on_pos(self, *args):
        del args

        with self.canvas:
            Color(*self.config['color'])
            KivyLine(points=self.config['points'],
                     width=self.config['thickness'],
                     cap=self.config['cap'],
                     joint=self.config['joint'],
                     cap_precision=self.config['cap_precision'],
                     joint_precision=self.config['joint_precision'],
                     close=self.config['close'])
Exemple #3
0
    def __init__(self, mc, config, key=None, **kwargs):
        super().__init__(mc=mc, config=config, key=key)

        with self.canvas:
            Color(*self.config['color'])
            KivyLine(bezier=self.config['points'],
                     width=self.config['thickness'],
                     cap=self.config['cap'],
                     joint=self.config['joint'],
                     cap_precision=self.config['cap_precision'],
                     joint_precision=self.config['joint_precision'],
                     close=self.config['close'],
                     bezier_precision=self.config['precision'])
Exemple #4
0
    def _draw_widget(self, *args) -> None:
        """Establish the drawing instructions for the widget."""
        del args

        if self.canvas is None:
            return

        # TODO: allow user to set rotation/scale origin
        center = center_of_points_list(self.points)
        self.canvas.clear()

        with self.canvas:
            Color(*self.color)
            Scale(self.scale, origin=center)
            Rotate(angle=self.rotation, origin=center)
            KivyLine(points=self.points,
                     width=self.thickness,
                     cap=self.cap,
                     joint=self.joint,
                     cap_precision=self.cap_precision,
                     joint_precision=self.joint_precision,
                     close=self.close)