maliang.standard.shapes¶
字数 9 个 阅读时间不到 1 分钟 访问量
源代码:maliang/standard/shapes.py
All standard Shape
classes
类:
-
Line
–Create a line for a widget
-
Rectangle
–Create a rectangle for a widget
-
Oval
–Create a oval for a widget
-
Arc
–Create a arc for a widget
-
RegularPolygon
–Create a regular polygon for a widget
-
RoundedRectangle
–Create a rounded rectangle for a widget
-
HalfRoundedRectangle
–Create a half rounded rectangle for a widget
-
SemicircularRectangle
–Create a semicircular rectangle for a widget
-
SharpRectangle
–Create a sharp rectangle for a widget
-
Parallelogram
–Create a parallelogram for a widget
Line ¶
Line(
widget: virtual.Widget,
relative_position: tuple[int, int] = (0, 0),
size: tuple[int, int] | None = None,
*,
points: list[tuple[float, float]] | None = None,
name: str | None = None,
gradient_animation: bool = True,
**kwargs
)
Create a line for a widget
widget
: parent widgetrelative_position
: position relative to its widgetssize
: size of elementpoints
: key points of linename
: name of elementgradient_animation
: Wether use animation to change colorkwargs
: extra parameters for CanvasItem
方法:
Rectangle ¶
Rectangle(
widget: Widget,
position: tuple[int, int] = (0, 0),
size: tuple[int, int] | None = None,
*,
name: str | None = None,
gradient_animation: bool | None = None,
**kwargs
)
Create a rectangle for a widget
方法:
Oval ¶
Oval(
widget: Widget,
position: tuple[int, int] = (0, 0),
size: tuple[int, int] | None = None,
*,
name: str | None = None,
gradient_animation: bool | None = None,
**kwargs
)
Create a oval for a widget
方法:
Arc ¶
Arc(
widget: Widget,
position: tuple[int, int] = (0, 0),
size: tuple[int, int] | None = None,
*,
name: str | None = None,
gradient_animation: bool | None = None,
**kwargs
)
Create a arc for a widget
方法:
RegularPolygon ¶
RegularPolygon(
widget: virtual.Widget,
relative_position: tuple[int, int] = (0, 0),
size: tuple[int, int] | None = None,
*,
side: int = 3,
angle: float = 0,
name: str | None = None,
gradient_animation: bool = True,
**kwargs
)
Create a regular polygon for a widget
widget
: parent widgetrelative_position
: position relative to its widgetssize
: size of elementside
: number of sides of a regular polygonangle
: number of radians of a regular polygon rotated clockwisename
: name of elementgradient_animation
: Wether use animation to change colorkwargs
: extra parameters for CanvasItem
方法:
RoundedRectangle ¶
RoundedRectangle(
widget: virtual.Widget,
relative_position: tuple[int, int] = (0, 0),
size: tuple[int, int] | None = None,
*,
radius: int = 5,
name: str | None = None,
gradient_animation: bool = True,
**kwargs
)
Create a rounded rectangle for a widget
widget
: parent widgetrelative_position
: position relative to its widgetssize
: size of elementradius
: radius of the filletname
: name of elementgradient_animation
: Wether use animation to change colorkwargs
: extra parameters for CanvasItem
方法:
HalfRoundedRectangle ¶
HalfRoundedRectangle(
widget: virtual.Widget,
relative_position: tuple[int, int] = (0, 0),
size: tuple[int, int] | None = None,
*,
radius: int = 5,
ignore: typing.Literal["left", "right"] = "left",
name: str | None = None,
gradient_animation: bool = True,
**kwargs
)
Create a half rounded rectangle for a widget
widget
: parent widgetrelative_position
: position relative to its widgetssize
: size of elementradius
: radius of the filletignore
: edges to ignorename
: name of elementgradient_animation
: Wether use animation to change colorkwargs
: extra parameters for CanvasItem
方法:
SemicircularRectangle ¶
SemicircularRectangle(
widget: Widget,
position: tuple[int, int] = (0, 0),
size: tuple[int, int] | None = None,
*,
name: str | None = None,
gradient_animation: bool | None = None,
**kwargs
)
Create a semicircular rectangle for a widget
方法:
SharpRectangle ¶
SharpRectangle(
widget: virtual.Widget,
relative_position: tuple[int, int] = (0, 0),
size: tuple[int, int] | None = None,
*,
theta: float = math.pi / 6,
ratio: tuple[float, float] = (0.5, 0.5),
name: str | None = None,
gradient_animation: bool = True,
**kwargs
)
Create a sharp rectangle for a widget
widget
: parent widgetrelative_position
: position relative to its widgetssize
: size of elementtheta
: number of radians of sharp cornersratio
: height ratio of the left and right sharp cornersname
: name of elementgradient_animation
: Wether use animation to change colorkwargs
: extra parameters for CanvasItem
方法:
Parallelogram ¶
Parallelogram(
widget: virtual.Widget,
relative_position: tuple[int, int] = (0, 0),
size: tuple[int, int] | None = None,
*,
theta: float = math.pi / 6,
name: str | None = None,
gradient_animation: bool = True,
**kwargs
)
Create a parallelogram for a widget
widget
: parent widgetrelative_position
: position relative to its widgetssize
: size of elementtheta
: number of radians that the parallelogram is inclined toname
: name of elementgradient_animation
: Wether use animation to change colorkwargs
: extra parameters for CanvasItem
方法: