Context

class pumpia.module_handling.context.BaseContext

Base class for context.

class pumpia.module_handling.context.PhantomContext(xmin: int, xmax: int, ymin: int, ymax: int, shape: Literal['rectangle', 'ellipse'])

Context for phantom shapes.

Parameters:
  • xmin (int) – The minimum x-coordinate.

  • xmax (int) – The maximum x-coordinate.

  • ymin (int) – The minimum y-coordinate.

  • ymax (int) – The maximum y-coordinate.

  • shape (PhantomShape) – The shape of the phantom.

class pumpia.module_handling.context.BoundBoxContext(xmin: int, xmax: int, ymin: int, ymax: int)

Context for bounding box.

Parameters:
  • xmin (int) – The minimum x-coordinate.

  • xmax (int) – The maximum x-coordinate.

  • ymin (int) – The minimum y-coordinate.

  • ymax (int) – The maximum y-coordinate.

class pumpia.module_handling.context.SimpleContext(xcent: float, ycent: float, width: int, height: int)

Context for center coordinates.

Parameters:
  • xcent (float) – The x-center coordinate.

  • ycent (float) – The y-center coordinate.

  • width (int) – The width of the image.

  • height (int) – The height of the image.

Context Managers

class pumpia.widgets.context_managers.BaseContextManager(parent: Misc, manager: Manager, direction: Literal['Horizontal', 'h', 'H', 'Vertical', 'v', 'V'] = 'Vertical', text: float | str = 'Context Manager', *, border: str | float = ..., borderwidth: str | float = ..., class_: str = '', cursor: str | tuple[str] | tuple[str, str] | tuple[str, str, str] | tuple[str, str, str, str] = '', height: str | float = 0, labelanchor: Literal['nw', 'n', 'ne', 'en', 'e', 'es', 'se', 's', 'sw', 'ws', 'w', 'wn'] = ..., labelwidget: Misc = ..., name: str = ..., padding: str | float | tuple[str | float] | tuple[str | float, str | float] | tuple[str | float, str | float, str | float] | tuple[str | float, str | float, str | float, str | float] = ..., relief: Literal['raised', 'sunken', 'flat', 'ridge', 'solid', 'groove'] = ..., style: str = '', takefocus: bool | Literal[0, 1, ''] | Callable[[str], bool | None] = '', underline: int = -1, width: str | float = 0)
class pumpia.widgets.context_managers.BaseContextManager(parent: Misc, manager: Manager, direction: Literal['Horizontal', 'h', 'H', 'Vertical', 'v', 'V'] = 'Vertical', text: float | str = 'Bound Box Options', **kw)

Base class for context managers.

Parameters:
  • parent (tk.Misc) – The parent widget.

  • manager (Manager) – The manager object.

  • direction (DirectionType, optional) – The direction of the child widgets in the frame (default is “Vertical”).

  • text (float or str, optional) – The text for the labelframe (default is “Bound Box Options”).

  • **kw (dict) – Additional keyword arguments as defined by ttk Labelframe.

class pumpia.widgets.context_managers.SimpleContextManager(parent: Misc, manager: Manager, direction: Literal['Horizontal', 'h', 'H', 'Vertical', 'v', 'V'] = 'Vertical', text: float | str = 'Context Manager', *, border: str | float = ..., borderwidth: str | float = ..., class_: str = '', cursor: str | tuple[str] | tuple[str, str] | tuple[str, str, str] | tuple[str, str, str, str] = '', height: str | float = 0, labelanchor: Literal['nw', 'n', 'ne', 'en', 'e', 'es', 'se', 's', 'sw', 'ws', 'w', 'wn'] = ..., labelwidget: Misc = ..., name: str = ..., padding: str | float | tuple[str | float] | tuple[str | float, str | float] | tuple[str | float, str | float, str | float] | tuple[str | float, str | float, str | float, str | float] = ..., relief: Literal['raised', 'sunken', 'flat', 'ridge', 'solid', 'groove'] = ..., style: str = '', takefocus: bool | Literal[0, 1, ''] | Callable[[str], bool | None] = '', underline: int = -1, width: str | float = 0)
class pumpia.widgets.context_managers.SimpleContextManager(parent: Misc, manager: Manager, direction: Literal['Horizontal', 'h', 'H', 'Vertical', 'v', 'V'] = 'Vertical', text: float | str = 'Bound Box Options', **kw)

Simple context manager that returns the center context of the image. Has the same parameters as BaseContextManager.

class pumpia.widgets.context_managers.PhantomContextManager(parent: Misc, manager: Manager, shape: None | Literal['rectangle', 'ellipse'] | list[Literal['rectangle', 'ellipse']] = None, direction: Literal['Horizontal', 'h', 'H', 'Vertical', 'v', 'V'] = 'Vertical', text: float | str = 'Bound Box Options', *, border: str | float = ..., borderwidth: str | float = ..., class_: str = '', cursor: str | tuple[str] | tuple[str, str] | tuple[str, str, str] | tuple[str, str, str, str] = '', height: str | float = 0, labelanchor: Literal['nw', 'n', 'ne', 'en', 'e', 'es', 'se', 's', 'sw', 'ws', 'w', 'wn'] = ..., labelwidget: Misc = ..., name: str = ..., padding: str | float | tuple[str | float] | tuple[str | float, str | float] | tuple[str | float, str | float, str | float] | tuple[str | float, str | float, str | float, str | float] = ..., relief: Literal['raised', 'sunken', 'flat', 'ridge', 'solid', 'groove'] = ..., style: str = '', takefocus: bool | Literal[0, 1, ''] | Callable[[str], bool | None] = '', underline: int = -1, width: str | float = 0)
class pumpia.widgets.context_managers.PhantomContextManager(parent: Misc, manager: Manager, shape: None | Literal['rectangle', 'ellipse'] | list[Literal['rectangle', 'ellipse']] = None, direction: Literal['Horizontal', 'h', 'H', 'Vertical', 'v', 'V'] = 'Vertical', text: float | str = 'Bound Box Options', **kw)

Context manager for phantom images. Has the same parameters as BaseContextManager.

class pumpia.widgets.context_managers.ManualPhantomManager(parent: Misc, manager: Manager, shape: None | Literal['rectangle', 'ellipse'] | list[Literal['rectangle', 'ellipse']] = None, direction: Literal['Horizontal', 'h', 'H', 'Vertical', 'v', 'V'] = 'Vertical', text: float | str = 'Bound Box Options', *, border: str | float = ..., borderwidth: str | float = ..., class_: str = '', cursor: str | tuple[str] | tuple[str, str] | tuple[str, str, str] | tuple[str, str, str, str] = '', height: str | float = 0, labelanchor: Literal['nw', 'n', 'ne', 'en', 'e', 'es', 'se', 's', 'sw', 'ws', 'w', 'wn'] = ..., labelwidget: Misc = ..., name: str = ..., padding: str | float | tuple[str | float] | tuple[str | float, str | float] | tuple[str | float, str | float, str | float] | tuple[str | float, str | float, str | float, str | float] = ..., relief: Literal['raised', 'sunken', 'flat', 'ridge', 'solid', 'groove'] = ..., style: str = '', takefocus: bool | Literal[0, 1, ''] | Callable[[str], bool | None] = '', underline: int = -1, width: str | float = 0)
class pumpia.widgets.context_managers.ManualPhantomManager(parent: Misc, manager: Manager, shape: None | Literal['rectangle', 'ellipse'] | list[Literal['rectangle', 'ellipse']] = None, direction: Literal['Horizontal', 'h', 'H', 'Vertical', 'v', 'V'] = 'Vertical', text: float | str = 'Bound Box Options', **kw)

Context manager for phantom images, user inputs shape and bounding box manually. Has the same parameters as BaseContextManager unless stated below.

Parameters:

shape (PhantomShapes, optional) – The shape of the phantom (default is None).

class pumpia.widgets.context_managers.AutoPhantomManager(parent: Misc, manager: Manager, mode: Literal['auto', 'manual'] = 'auto', sensitivity: int = 3, top_perc: int = 95, iterations: int = 2, cull_perc: int = 80, bubble_offset: int = 0, bubble_side: Literal['top', 'bottom', 'left', 'right'] = 'top', shape: None | Literal['rectangle', 'ellipse'] | list[Literal['rectangle', 'ellipse']] = None, direction: Literal['Horizontal', 'h', 'H', 'Vertical', 'v', 'V'] = 'Vertical', text: float | str = 'Bound Box Options', *, border: str | float = ..., borderwidth: str | float = ..., class_: str = '', cursor: str | tuple[str] | tuple[str, str] | tuple[str, str, str] | tuple[str, str, str, str] = '', height: str | float = 0, labelanchor: Literal['nw', 'n', 'ne', 'en', 'e', 'es', 'se', 's', 'sw', 'ws', 'w', 'wn'] = ..., labelwidget: Misc = ..., name: str = ..., padding: str | float | tuple[str | float] | tuple[str | float, str | float] | tuple[str | float, str | float, str | float] | tuple[str | float, str | float, str | float, str | float] = ..., relief: Literal['raised', 'sunken', 'flat', 'ridge', 'solid', 'groove'] = ..., style: str = '', takefocus: bool | Literal[0, 1, ''] | Callable[[str], bool | None] = '', underline: int = -1, width: str | float = 0)
class pumpia.widgets.context_managers.AutoPhantomManager(parent: Misc, manager: Manager, mode: Literal['auto', 'manual'] = 'auto', sensitivity: int = 3, top_perc: int = 95, iterations: int = 2, cull_perc: int = 80, bubble_offset: int = 0, bubble_side: Literal['top', 'bottom', 'left', 'right'] = 'top', shape: None | Literal['rectangle', 'ellipse'] | list[Literal['rectangle', 'ellipse']] = None, direction: Literal['Horizontal', 'h', 'H', 'Vertical', 'v', 'V'] = 'Vertical', text: float | str = 'Bound Box Options', **kw)

Context manager for phantom images, using the phantom_boundbox_manual or phantom_boundary_automatic functions. Has the same parameters as BaseContextManager unless stated below.

Parameters:
  • mode (Literal["auto", "manual"], optional) – The initial mode of the manager (default is “auto”).

  • sensitivity (int, optional) – The initial sensitivity for boundary detection (default is 3).

  • top_perc (int, optional) – The initial maximum percentage for boundary detection (default is 95).

  • iterations (int, optional) – The initial number of iterations for boundary detection (default is 2).

  • cull_perc (int, optional) – The initial cull percentage for boundary detection (default is 80).

  • bubble_offset (int, optional) – The initial bubble offset for boundary detection (default is 0).

  • bubble_side (SideType, optional) – The initial side of the bubble for boundary detection (default is “top”).

  • shape (PhantomShapes, optional) – The initial shape of the phantom (default is None).

Context Manager Generators

class pumpia.widgets.context_managers.BaseContextManagerGenerator(*, direction: Literal['Horizontal', 'h', 'H', 'Vertical', 'v', 'V'] = 'Vertical', text: float | str = 'Bound Box Options', border: str | float = ..., borderwidth: str | float = ..., class_: str = '', cursor: str | tuple[str] | tuple[str, str] | tuple[str, str, str] | tuple[str, str, str, str] = '', height: str | float = 0, labelanchor: Literal['nw', 'n', 'ne', 'en', 'e', 'es', 'se', 's', 'sw', 'ws', 'w', 'wn'] = ..., labelwidget: Misc = ..., name: str = ..., padding: str | float | tuple[str | float] | tuple[str | float, str | float] | tuple[str | float, str | float, str | float] | tuple[str | float, str | float, str | float, str | float] = ..., relief: Literal['raised', 'sunken', 'flat', 'ridge', 'solid', 'groove'] = ..., style: str = '', takefocus: bool | Literal[0, 1, ''] | Callable[[str], bool | None] = '', underline: int = -1, width: str | float = 0)
class pumpia.widgets.context_managers.BaseContextManagerGenerator(**kw)

Base class for context manager generators.

class pumpia.widgets.context_managers.SimpleContextManagerGenerator(*, direction: Literal['Horizontal', 'h', 'H', 'Vertical', 'v', 'V'] = 'Vertical', text: float | str = 'Bound Box Options', border: str | float = ..., borderwidth: str | float = ..., class_: str = '', cursor: str | tuple[str] | tuple[str, str] | tuple[str, str, str] | tuple[str, str, str, str] = '', height: str | float = 0, labelanchor: Literal['nw', 'n', 'ne', 'en', 'e', 'es', 'se', 's', 'sw', 'ws', 'w', 'wn'] = ..., labelwidget: Misc = ..., name: str = ..., padding: str | float | tuple[str | float] | tuple[str | float, str | float] | tuple[str | float, str | float, str | float] | tuple[str | float, str | float, str | float, str | float] = ..., relief: Literal['raised', 'sunken', 'flat', 'ridge', 'solid', 'groove'] = ..., style: str = '', takefocus: bool | Literal[0, 1, ''] | Callable[[str], bool | None] = '', underline: int = -1, width: str | float = 0)
class pumpia.widgets.context_managers.SimpleContextManagerGenerator(**kw)

Generator for SimpleContextManager.

class pumpia.widgets.context_managers.PhantomContextManagerGenerator(*, shape: None | Literal['rectangle', 'ellipse'] | list[Literal['rectangle', 'ellipse']] = None, direction: Literal['Horizontal', 'h', 'H', 'Vertical', 'v', 'V'] = 'Vertical', text: float | str = 'Bound Box Options', border: str | float = ..., borderwidth: str | float = ..., class_: str = '', cursor: str | tuple[str] | tuple[str, str] | tuple[str, str, str] | tuple[str, str, str, str] = '', height: str | float = 0, labelanchor: Literal['nw', 'n', 'ne', 'en', 'e', 'es', 'se', 's', 'sw', 'ws', 'w', 'wn'] = ..., labelwidget: Misc = ..., name: str = ..., padding: str | float | tuple[str | float] | tuple[str | float, str | float] | tuple[str | float, str | float, str | float] | tuple[str | float, str | float, str | float, str | float] = ..., relief: Literal['raised', 'sunken', 'flat', 'ridge', 'solid', 'groove'] = ..., style: str = '', takefocus: bool | Literal[0, 1, ''] | Callable[[str], bool | None] = '', underline: int = -1, width: str | float = 0)
class pumpia.widgets.context_managers.PhantomContextManagerGenerator(**kw)

Generator for PhantomContextManager.

class pumpia.widgets.context_managers.ManualPhantomManagerGenerator(*, shape: None | Literal['rectangle', 'ellipse'] | list[Literal['rectangle', 'ellipse']] = None, direction: Literal['Horizontal', 'h', 'H', 'Vertical', 'v', 'V'] = 'Vertical', text: float | str = 'Bound Box Options', border: str | float = ..., borderwidth: str | float = ..., class_: str = '', cursor: str | tuple[str] | tuple[str, str] | tuple[str, str, str] | tuple[str, str, str, str] = '', height: str | float = 0, labelanchor: Literal['nw', 'n', 'ne', 'en', 'e', 'es', 'se', 's', 'sw', 'ws', 'w', 'wn'] = ..., labelwidget: Misc = ..., name: str = ..., padding: str | float | tuple[str | float] | tuple[str | float, str | float] | tuple[str | float, str | float, str | float] | tuple[str | float, str | float, str | float, str | float] = ..., relief: Literal['raised', 'sunken', 'flat', 'ridge', 'solid', 'groove'] = ..., style: str = '', takefocus: bool | Literal[0, 1, ''] | Callable[[str], bool | None] = '', underline: int = -1, width: str | float = 0)
class pumpia.widgets.context_managers.ManualPhantomManagerGenerator(**kw)

Generator for ManualPhantomManager.

class pumpia.widgets.context_managers.AutoPhantomManagerGenerator(*, mode: Literal['auto', 'manual'] = 'auto', sensitivity: int = 3, top_perc: int = 95, iterations: int = 2, cull_perc: int = 80, bubble_offset: int = 0, bubble_side: Literal['top', 'bottom', 'left', 'right'] = 'top', shape: None | Literal['rectangle', 'ellipse'] | list[Literal['rectangle', 'ellipse']] = None, direction: Literal['Horizontal', 'h', 'H', 'Vertical', 'v', 'V'] = 'Vertical', text: float | str = 'Bound Box Options', border: str | float = ..., borderwidth: str | float = ..., class_: str = '', cursor: str | tuple[str] | tuple[str, str] | tuple[str, str, str] | tuple[str, str, str, str] = '', height: str | float = 0, labelanchor: Literal['nw', 'n', 'ne', 'en', 'e', 'es', 'se', 's', 'sw', 'ws', 'w', 'wn'] = ..., labelwidget: Misc = ..., name: str = ..., padding: str | float | tuple[str | float] | tuple[str | float, str | float] | tuple[str | float, str | float, str | float] | tuple[str | float, str | float, str | float, str | float] = ..., relief: Literal['raised', 'sunken', 'flat', 'ridge', 'solid', 'groove'] = ..., style: str = '', takefocus: bool | Literal[0, 1, ''] | Callable[[str], bool | None] = '', underline: int = -1, width: str | float = 0)
class pumpia.widgets.context_managers.AutoPhantomManagerGenerator(**kw)

Generator for AutoPhantomManager.