跳转至

tkintertools.standard.shapes

字数 416 个   代码 157 行   阅读时间 3 分钟   访问量

All standard Shape classes

🟢HalfRoundedRectangle

class public | Shape

def __init__(
    self,
    widget: 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,
    animation: bool = True,
    styles: dict[str, dict[str, str]] | None = None,
    **kwargs,
) -> None: ...
Create a half rounded rectangle for a widget

  • widget: parent widget
  • relative_position: position relative to its widgets
  • size: size of component
  • radius: radius of the fillet
  • ignore: edges to ignore
  • name: name of component
  • animation: Wether use animation to change color
  • styles: style dict of component
  • 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: ...

🟡display

method public

1
2
3
def display(
    self,
) -> None: ...

🟢Line

class public | Shape

def __init__(
    self,
    widget: Widget,
    relative_position: tuple[int, int] = (0, 0),
    size: tuple[int, int] | None = None,
    *,
    points: list[tuple[float, float]] = [],
    name: str | None = None,
    animation: bool = True,
    styles: dict[str | int, dict[str | int, dict[str, str]]] | None = None,
    **kwargs,
) -> None: ...
Create a line for a widget

  • widget: parent widget
  • relative_position: position relative to its widgets
  • size: size of component
  • points: key points of line
  • name: name of component
  • animation: Wether use animation to change color
  • styles: style dict of component
  • 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: ...

🟡display

method public

1
2
3
def display(
    self,
) -> None: ...

🟢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: ...

🟡detect

method public

1
2
3
4
5
def detect(
    self,
    x: int,
    y: int,
) -> bool: ...

🟡display

method public

1
2
3
def display(
    self,
) -> None: ...

🟢Parallelogram

class public | Shape

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

  • widget: parent widget
  • relative_position: position relative to its widgets
  • size: size of component
  • theta: number of radians that the parallelogram is inclined to
  • name: name of component
  • animation: Wether use animation to change color
  • styles: style dict of component
  • 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: ...

🟡display

method public

1
2
3
def display(
    self,
) -> None: ...

🟢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: ...

🟡display

method public

1
2
3
def display(
    self,
) -> None: ...

🟢RegularPolygon

class public | Shape

def __init__(
    self,
    widget: Widget,
    relative_position: tuple[int, int] = (0, 0),
    size: tuple[int, int] | None = None,
    *,
    side: int = 3,
    angle: float = 0,
    name: str | None = None,
    animation: bool = True,
    styles: dict[str, dict[str, str]] | None = None,
    **kwargs,
) -> None: ...
Create a regular polygon for a widget

  • widget: parent widget
  • relative_position: position relative to its widgets
  • size: size of component
  • side: number of sides of a regular polygon
  • angle: number of radians of a regular polygon rotated clockwise
  • name: name of component
  • animation: Wether use animation to change color
  • styles: style dict of component
  • 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: ...

🟡display

method public

1
2
3
def display(
    self,
) -> None: ...

🟢RoundedRectangle

class public | Shape

def __init__(
    self,
    widget: Widget,
    relative_position: tuple[int, int] = (0, 0),
    size: tuple[int, int] | None = None,
    *,
    radius: int = 5,
    name: str | None = None,
    animation: bool = True,
    styles: dict[str, dict[str, str]] | None = None,
    **kwargs,
) -> None: ...
Create a rounded rectangle for a widget

  • widget: parent widget
  • relative_position: position relative to its widgets
  • size: size of component
  • radius: radius of the fillet
  • name: name of component
  • animation: Wether use animation to change color
  • styles: style dict of component
  • 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: ...

🟡display

method public

1
2
3
def display(
    self,
) -> None: ...

🟢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: ...

🟡detect

method public

1
2
3
4
5
def detect(
    self,
    x: int,
    y: int,
) -> bool: ...

🟡display

method public

1
2
3
def display(
    self,
) -> None: ...

🟢SharpRectangle

class public | Shape

def __init__(
    self,
    widget: 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,
    animation: bool = True,
    styles: dict[str, dict[str, str]] | None = None,
    **kwargs,
) -> None: ...
Create a sharp rectangle for a widget

  • widget: parent widget
  • relative_position: position relative to its widgets
  • size: size of component
  • theta: number of radians of sharp corners
  • ratio: height ratio of the left and right sharp corners
  • name: name of component
  • animation: Wether use animation to change color
  • styles: style dict of component
  • 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: ...

🟡display

method public

1
2
3
def display(
    self,
) -> None: ...