跳转至

maliang.standard.shapes

字数 515 个   代码 159 行   阅读时间 4 分钟   访问量

源代码:maliang/standard/shapes.py

All standard Shape classes

🟢Arc

class public | Shape

🟡coords

method public

1
2
3
4
5
def coords(
    self,
    size: tuple[float, float] | None = None,
    position: tuple[float, float] | None = None,
) -> None: ...
Resize the Element

🟡display

method public

1
2
3
def display(
    self,
) -> None: ...
Display the Element on a Canvas

🟢HalfRoundedRectangle

class public | Shape

def __init__(
    self,
    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,
) -> None: ...
Create a half rounded rectangle for a widget

  • widget: parent widget
  • relative_position: position relative to its widgets
  • size: size of element
  • radius: radius of the fillet
  • ignore: edges to ignore
  • name: name of element
  • gradient_animation: Wether use animation to change color
  • kwargs: extra parameters for CanvasItem

🟡coords

method public

1
2
3
4
5
def coords(
    self,
    size: tuple[float, float] | None = None,
    position: tuple[float, float] | None = None,
) -> None: ...
Resize the Element

🟡display

method public

1
2
3
def display(
    self,
) -> None: ...
Display the Element on a Canvas

🟢Line

class public | Shape

def __init__(
    self,
    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,
) -> None: ...
Create a line for a widget

  • widget: parent widget
  • relative_position: position relative to its widgets
  • size: size of element
  • points: key points of line
  • name: name of element
  • gradient_animation: Wether use animation to change color
  • kwargs: extra parameters for CanvasItem

🟡coords

method public

1
2
3
4
5
def coords(
    self,
    size: tuple[float, float] | None = None,
    position: tuple[float, float] | None = None,
) -> None: ...
Resize the Element

🟡display

method public

1
2
3
def display(
    self,
) -> None: ...
Display the Element on a Canvas

🟢Oval

class public | Shape

🟡coords

method public

1
2
3
4
5
def coords(
    self,
    size: tuple[float, float] | None = None,
    position: tuple[float, float] | None = None,
) -> None: ...
Resize the Element

🟡detect

method public

1
2
3
4
5
def detect(
    self,
    x: int,
    y: int,
) -> bool: ...
Detect whether the specified coordinates are within Element

🟡display

method public

1
2
3
def display(
    self,
) -> None: ...
Display the Element on a Canvas

🟢Parallelogram

class public | Shape

def __init__(
    self,
    widget: virtual.Widget,
    relative_position: tuple[int, int] = (0, 0),
    size: tuple[int, int] | None = None,
    *,
    theta: float = 0.5235987755982988,
    name: str | None = None,
    gradient_animation: bool = True,
    **kwargs,
) -> None: ...
Create a parallelogram for a widget

  • widget: parent widget
  • relative_position: position relative to its widgets
  • size: size of element
  • theta: number of radians that the parallelogram is inclined to
  • name: name of element
  • gradient_animation: Wether use animation to change color
  • kwargs: extra parameters for CanvasItem

🟡coords

method public

1
2
3
4
5
def coords(
    self,
    size: tuple[float, float] | None = None,
    position: tuple[float, float] | None = None,
) -> None: ...
Resize the Element

🟡display

method public

1
2
3
def display(
    self,
) -> None: ...
Display the Element on a Canvas

🟢Rectangle

class public | Shape

🟡coords

method public

1
2
3
4
5
def coords(
    self,
    size: tuple[float, float] | None = None,
    position: tuple[float, float] | None = None,
) -> None: ...
Resize the Element

🟡display

method public

1
2
3
def display(
    self,
) -> None: ...
Display the Element on a Canvas

🟢RegularPolygon

class public | Shape

def __init__(
    self,
    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,
) -> None: ...
Create a regular polygon for a widget

  • widget: parent widget
  • relative_position: position relative to its widgets
  • size: size of element
  • side: number of sides of a regular polygon
  • angle: number of radians of a regular polygon rotated clockwise
  • name: name of element
  • gradient_animation: Wether use animation to change color
  • kwargs: extra parameters for CanvasItem

🟡coords

method public

1
2
3
4
5
def coords(
    self,
    size: tuple[float, float] | None = None,
    position: tuple[float, float] | None = None,
) -> None: ...
Resize the Element

🟡display

method public

1
2
3
def display(
    self,
) -> None: ...
Display the Element on a Canvas

🟢RoundedRectangle

class public | Shape

def __init__(
    self,
    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,
) -> None: ...
Create a rounded rectangle for a widget

  • widget: parent widget
  • relative_position: position relative to its widgets
  • size: size of element
  • radius: radius of the fillet
  • name: name of element
  • gradient_animation: Wether use animation to change color
  • kwargs: extra parameters for CanvasItem

🟡coords

method public

1
2
3
4
5
def coords(
    self,
    size: tuple[float, float] | None = None,
    position: tuple[float, float] | None = None,
) -> None: ...
Resize the Element

🟡display

method public

1
2
3
def display(
    self,
) -> None: ...
Display the Element on a Canvas

🟢SemicircularRectangle

class public | Shape

🟡coords

method public

1
2
3
4
5
def coords(
    self,
    size: tuple[float, float] | None = None,
    position: tuple[float, float] | None = None,
) -> None: ...
Resize the Element

🟡detect

method public

1
2
3
4
5
def detect(
    self,
    x: int,
    y: int,
) -> bool: ...
Detect whether the specified coordinates are within Element

🟡display

method public

1
2
3
def display(
    self,
) -> None: ...
Display the Element on a Canvas

🟢SharpRectangle

class public | Shape

def __init__(
    self,
    widget: virtual.Widget,
    relative_position: tuple[int, int] = (0, 0),
    size: tuple[int, int] | None = None,
    *,
    theta: float = 0.5235987755982988,
    ratio: tuple[float, float] = (0.5, 0.5),
    name: str | None = None,
    gradient_animation: bool = True,
    **kwargs,
) -> None: ...
Create a sharp rectangle for a widget

  • widget: parent widget
  • relative_position: position relative to its widgets
  • size: size of element
  • theta: number of radians of sharp corners
  • ratio: height ratio of the left and right sharp corners
  • name: name of element
  • gradient_animation: Wether use animation to change color
  • kwargs: extra parameters for CanvasItem

🟡coords

method public

1
2
3
4
5
def coords(
    self,
    size: tuple[float, float] | None = None,
    position: tuple[float, float] | None = None,
) -> None: ...
Resize the Element

🟡display

method public

1
2
3
def display(
    self,
) -> None: ...
Display the Element on a Canvas