コード例 #1
0
class DrawLine(DrawCommand):
    """Draws a line."""

    p1: Pos2D = DrawPropertyPos()
    p2: Pos2D = DrawPropertyPos()
    color: ColorRGBA = DrawPropertyColorRGBA()
    thickness: int = DrawProperty()

    def _draw_internal(self, draw_args) -> None:
        dpgcore.draw_line(self.canvas.id, tag=self.id, **draw_args)
コード例 #2
0
class DrawArrow(DrawCommand):
    """Draw a line with an arrowhead."""

    p1: Pos2D = DrawPropertyPos()
    p2: Pos2D = DrawPropertyPos()
    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)
コード例 #3
0
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)
コード例 #4
0
class DrawRectangle(DrawCommand):
    """Draws a rectangle."""

    pmin: Pos2D = DrawPropertyPos()
    pmax: Pos2D = DrawPropertyPos()
    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)
コード例 #5
0
class DrawBezierCurve(DrawCommand):
    """Draws a bezier curve."""

    p1: Pos2D = DrawPropertyPos()
    p2: Pos2D = DrawPropertyPos()
    p3: Pos2D = DrawPropertyPos()
    p4: Pos2D = DrawPropertyPos()
    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)
コード例 #6
0
class DrawQuad(DrawCommand):
    """Draws a quadrilateral."""

    p1: Pos2D = DrawPropertyPos()
    p2: Pos2D = DrawPropertyPos()
    p3: Pos2D = DrawPropertyPos()
    p4: Pos2D = DrawPropertyPos()
    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)
コード例 #7
0
class DrawText(DrawCommand):
    """Draws text."""

    pos: Pos2D = DrawPropertyPos()
    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)
コード例 #8
0
class DrawCircle(DrawCommand):
    """Draws a circle."""

    center: Pos2D = DrawPropertyPos()
    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)