Workspace#
- class easy_pil.workspace.Workspace(size: Tuple[int, int])#
Workspace class for working with layers and components
- add_component(*, layer_name: str | None = None, identifier: str | None = None, func: Callable | str, options: ComponentKwargs)#
Add component to a layer
- Parameters:
layer_name (str) – name of the layer
identifier (str) – unique name for a component
func (Union[Callable, str]) – the function or function name from editor class
options (ComponentKwargs) – keyword arguments for the func
- Raises:
ValueError – if the layer is not available in the workspace
- create_layer(name: str, background: int | str | Tuple[int, int, int] | Tuple[int, int, int, int] = (0, 0, 0, 0))#
Creates a layer
- Parameters:
name (str) – name of the layer
background (Color) – background color of the layer
- remove_component(*, layer_name: str | None = None, identifier: str)#
Remove component from a layer
- Parameters:
layer_name (str) – name of the layer
identifier (str) – unique name for a component
- Raises:
ValueError – if the layer is not available in the workspace
- remove_layer(name: str)#
Removes a layer
- Parameters:
name (str) – name of the layer
- Raises:
ValueError – if the layer is not available in the workspace
- set_working_layer(name: str)#
Sets a layer as working layer
- Parameters:
name (str) – name of the layer
- Raises:
ValueError – if the layer is not available in the workspace
- update_component(*, layer_name: str | None = None, identifier: str, options: ComponentKwargs)#
Update component of a layer
- Parameters:
layer_name (str) – name of the layer
identifier (str) – unique name for a component
options (ComponentKwargs) – modified options
- Raises:
ValueError – if the layer is not available in the workspace
- update_layer(layer_name: str, new_layer_name: str | None = None, background: int | str | Tuple[int, int, int] | Tuple[int, int, int, int] | None = None)#
Creates a layer
- Parameters:
layer_name (str) – name of the layer
new_layer_name (str, Optional) – updated name of the layer, defaults to None
background (Color) – background color of the layer, defaults to None
- Raises:
ValueError – if the layer is not available in the workspace