window¶
classDiagram
CachedClass <|-- Container
CharmyObject <|-- WindowEntity
Container <|-- Window
EventHandling <|-- WindowEntity
WindowEntity <|-- Window
Charmy windows.
- class charmy.widgets.window.WindowEntity(parent: CharmyManager | None = None, size: tuple[int, int] = (150, 150), title: str = 'Charmy Window', background: Texture | tuple[int, int, int] | tuple[int, int, int, float] | str | None | tuple[int, int, int, Literal[0]] = (150, 150, 150), *args, **kwargs)¶
基类:
CharmyObject,EventHandlingContains abilities of window entities.
- __init__(parent: CharmyManager | None = None, size: tuple[int, int] = (150, 150), title: str = 'Charmy Window', background: Texture | tuple[int, int, int] | tuple[int, int, int, float] | str | None | tuple[int, int, int, Literal[0]] = (150, 150, 150), *args, **kwargs)¶
To create and initialize a window.
- property pos: tuple[int, int]¶
Window position on screen.
- property abs_pos: tuple[int, int]¶
- property size: tuple[int, int]¶
Window size.
- property title: str¶
Window title.
Type string, internally stored as string. Getting value of this property will return current window title, while setting value will immediately change window's title.
- property background: Texture | tuple[int, int, int] | tuple[int, int, int, float] | str | None | tuple[int, int, int, Literal[0]]¶
Window background
- property icon: bytes¶
Window title.
Type string, pathlib.Path, bytes or Image.Image from PIL, internally stored as bytes. Getting value of this property will return current window icon, while setting value will immediately change window's title.
When setting value, values of type string or Path express a path to the icon file, while those of type bytes or Image express icon image content.
- show() Self¶
Show the window.
- Returns:
self: The window itself
- draw_frame(drawing_list: list[DrawnObject]) Self¶
Draw a frame for the window.
- 参数:
drawing_list -- The list of the objects to draw
- update(force_redraw: bool = False)¶
Update the window.
- 参数:
force_redraw -- Redraw the window content regardless presence of changes
- destroy()¶
Close the window and mark it as inactive.
- class charmy.widgets.window.Window(parent: CharmyManager | None = None, size: tuple[int, int] = (540, 360), title: str = 'Charmy Window', background: Texture | tuple[int, int, int] | tuple[int, int, int, float] | str | None | tuple[int, int, int, Literal[0]] = (255, 255, 255))¶
-
Windows in Charmy.
- is_root_container: ClassVar[bool] = True¶
- __init__(parent: CharmyManager | None = None, size: tuple[int, int] = (540, 360), title: str = 'Charmy Window', background: Texture | tuple[int, int, int] | tuple[int, int, int, float] | str | None | tuple[int, int, int, Literal[0]] = (255, 255, 255))¶
To create a window in Charmy.
- update(force_redraw: bool = False)¶
Update the window.
- 参数:
force_redraw -- Redraw the window content regardless presence of changes
- destroy()¶
Destroy the window and its children.