class DrawText(DrawCommand): """Draws text.""" pos: Tuple[float, float] = DrawPropertyPos2D() text: str = DrawProperty() color: ColorRGBA = DrawPropertyColorRGBA() font_size: int = DrawProperty(key='size') def __draw_internal__(self, draw_args) -> None: dpgcore.draw_text(self.canvas.id, tag=self.id, **draw_args)
class DrawArrow(DrawCommand): """Draw a line with an arrowhead.""" p1: Tuple[float, float] = DrawPropertyPos2D() p2: Tuple[float, float] = DrawPropertyPos2D() color: ColorRGBA = DrawPropertyColorRGBA() thickness: int = DrawProperty() arrow_size: int = DrawProperty(key='size') def __draw_internal__(self, draw_args) -> None: dpgcore.draw_arrow(self.canvas.id, tag=self.id, **draw_args)
class DrawCircle(DrawCommand): """Draws a circle.""" center: Tuple[float, float] = DrawPropertyPos2D() radius: float = DrawProperty() color: ColorRGBA = DrawPropertyColorRGBA() segments: int = DrawProperty() thickness: float = DrawProperty() fill: ColorRGBA = DrawPropertyColorRGBA() def __draw_internal__(self, draw_args) -> None: dpgcore.draw_circle(self.canvas.id, tag=self.id, **draw_args)
class DrawRectangle(DrawCommand): """Draws a rectangle.""" pmin: Tuple[float, float] = DrawPropertyPos2D() pmax: Tuple[float, float] = DrawPropertyPos2D() color: ColorRGBA = DrawPropertyColorRGBA() fill: ColorRGBA = DrawPropertyColorRGBA() rounding: float = DrawProperty() thickness: float = DrawProperty() def __draw_internal__(self, draw_args) -> None: dpgcore.draw_rectangle(self.canvas.id, tag=self.id, **draw_args)
class DrawBezierCurve(DrawCommand): """Draws a bezier curve.""" p1: Tuple[float, float] = DrawPropertyPos2D() p2: Tuple[float, float] = DrawPropertyPos2D() p3: Tuple[float, float] = DrawPropertyPos2D() p4: Tuple[float, float] = DrawPropertyPos2D() color: ColorRGBA = DrawPropertyColorRGBA() thickness: float = DrawProperty() segments: int = DrawProperty() def __draw_internal__(self, draw_args) -> None: dpgcore.draw_bezier_curve(self.canvas.id, tag=self.id, **draw_args)
class DrawPolyLine(DrawCommand): """Draws connected lines.""" @DrawProperty() def points(self) -> Sequence[Tuple[float, float]]: return [Pos2D(*p) for p in self.get_config()['points']] @points.getconfig def points(self, value: Sequence[Tuple[float, float]]): return {'points': [list(p) for p in value]} color: ColorRGBA = DrawPropertyColorRGBA() closed: bool = DrawProperty() thickness: float = DrawProperty() def __draw_internal__(self, draw_args) -> None: dpgcore.draw_polyline(self.canvas.id, tag=self.id, **draw_args)
class DrawLine(DrawCommand): """Draws a line.""" p1: Tuple[float, float] = DrawPropertyPos2D() p2: Tuple[float, float] = DrawPropertyPos2D() color: ColorRGBA = DrawPropertyColorRGBA() thickness: int = DrawProperty() def __draw_internal__(self, draw_args) -> None: dpgcore.draw_line(self.canvas.id, tag=self.id, **draw_args)
class DrawTriangle(DrawCommand): """Draws a triangle.""" p1: Pos2D = DrawPropertyPos() p2: Pos2D = DrawPropertyPos() p3: Pos2D = DrawPropertyPos() color: ColorRGBA = DrawPropertyColorRGBA() fill: ColorRGBA = DrawPropertyColorRGBA() thickness: float = DrawProperty() def _draw_internal(self, draw_args) -> None: dpgcore.draw_triangle(self.canvas.id, tag=self.id, **draw_args)
class DrawQuad(DrawCommand): """Draws a quadrilateral.""" p1: Tuple[float, float] = DrawPropertyPos2D() p2: Tuple[float, float] = DrawPropertyPos2D() p3: Tuple[float, float] = DrawPropertyPos2D() p4: Tuple[float, float] = DrawPropertyPos2D() color: ColorRGBA = DrawPropertyColorRGBA() fill: ColorRGBA = DrawPropertyColorRGBA() thickness: float = DrawProperty() def __draw_internal__(self, draw_args) -> None: dpgcore.draw_quad(self.canvas.id, tag=self.id, **draw_args)
class DrawPolygon(DrawCommand): """Draws a polygon.""" @DrawProperty() def points(self) -> Sequence[Pos2D]: return [DrawPos(*p) for p in self.get_config()['points']] @points.getconfig def points(self, value: Sequence[Pos2D]): return {'points': [list(p) for p in value]} color: ColorRGBA = DrawPropertyColorRGBA() fill: ColorRGBA = DrawPropertyColorRGBA() thickness: float = DrawProperty() def _draw_internal(self, draw_args) -> None: dpgcore.draw_polygon(self.canvas.id, tag=self.id, **draw_args)