Workspace¶
- class ez_pil.workspace.Workspace(size)¶
Workspace class for working with layers and components.
- add_component(*, layer_name=None, identifier=None, func, options)¶
Add component to a layer.
- Parameters:
layer_name (
str|None) – name of the layeridentifier (
str|None) – unique name for a componentfunc (
Callable|str) – the function or function name from editor classoptions (
ComponentKwargs) – keyword arguments for the func
- Raises:
ValueError – if the layer is not available in the workspace
- create_layer(name, background=(0, 0, 0, 0))¶
Create a layer.
- Parameters:
name (
str) – name of the layerbackground (
int|str|tuple[int,int,int] |tuple[int,int,int,int]) – background color of the layer
- remove_component(*, layer_name=None, identifier)¶
Remove component from a layer.
- Parameters:
layer_name (
str|None) – name of the layeridentifier (
str) – unique name for a component
- Raises:
ValueError – if the layer is not available in the workspace
- remove_layer(name)¶
Remove a layer.
- Parameters:
name (
str) – name of the layer- Raises:
ValueError – if the layer is not available in the workspace
- set_working_layer(name)¶
Set 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=None, identifier, options)¶
Update component of a layer.
- Parameters:
layer_name (
str|None) – name of the layeridentifier (
str) – unique name for a componentoptions (
ComponentKwargs) – modified options
- Raises:
ValueError – if the layer is not available in the workspace
- update_layer(layer_name, new_layer_name=None, background=None)¶
Create a layer.
- Parameters:
layer_name (
str) – name of the layernew_layer_name (
str|None) – updated name of the layer, defaults to Nonebackground (
int|str|tuple[int,int,int] |tuple[int,int,int,int] |None) – background color of the layer, defaults to None
- Raises:
ValueError – if the layer is not available in the workspace