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)
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'])
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'])
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)