display Module

Examples

Creating and Showing a Display

References

class minimal.display.Frame(width: float, height: float, color: ~typing.Optional[~typing.Type[~colour.Color]] = <Color white>)[source]

Static Frame Display

Notes

Frames can be used to represent single static display or can be successively added into the Canvas object to represent a single frame

width

Display Width

Type

float

height

Display Height

Type

float

color

Display background color. Default: Color(rgb=(1,1,1))

Type

Color

inspections

Coordinates of left-click event on display window

Type

list

data

Pixel data for cairo.ImageSurface; can be directly modified for rendering. #TODO: Find a better description

Type

np.array

surface

Cairo surface object for rendering memory buffers

Type

cairo.ImageSurface

canvas

Cairo context object for drawing instructions

Type

cairo.Context

Keyword Arguments
  • width (float) – Display Width

  • height (float) – Display Height

  • color (Color, optional) – Display background Color. Default: Color(rgb=(1,1,1))

Examples

>>> frame = minimal.display.Frame(800, 800)
>>> circle = mininmal.shapes.Circle(400, 400, 100)
>>> frame.add(circle)
>>> frame.show()
add(obj: Any, _index: Optional[int] = None) None[source]
add(objs: Union[Tuple, list], indicies: Optional[Iterable[int]] = None) None
add(objs: Union[Tuple, list], indicies: Optional[Iterable[int]] = None) None

Draws drawing objects in frame

Notes

Unlike Canvas, Frames are drawn upon addition and not placed in any order attribute. Therefore, passing an index to a frame add method will not do anything

Keyword Arguments
  • obj (object) – Drawing object to add to canvas

  • _index (int, optional) – Adds object at particular index in order. Has no use in Frame Object (added from ABDisplay inheritance)

from_hdf5(fp: str, name: str, root: Optional[str] = '/') None[source]

Load Frame from HDF5

Keyword Arguments
  • fp (str) – Filename or pathlib.Path object for Image

  • name (str) – Name of dataset to save Frame to

  • root (str, optional) – Hierarchical root for dataset

property shape: Tuple[int, int, int]

Returns shape of display object

show(exit_key: str = 'q', inspect: bool = False) None[source]

Visualizes current Frame in seperate Window

Keyword Arguments
  • exit_key (str, optional) – Key to exit out of Frame Window. Default: ‘q’

  • inspect (bool, optional) – Allows mouse clicks callback on window to inspect and mark points of interests

to_hdf5(fp: str, name: str, root: Optional[str] = '/') None[source]

Save Frame to HDF5

Notes

If HDF5 at ‘fp’ already exists, will append on to it

Keyword Arguments
  • fp (str) – Filename or pathlib.Path object for Image

  • name (str) – Name of dataset to save Frame to

  • root (str, optional) – Hierarchical root for dataset

to_image(fp: str) None

Save Display to Image

Keyword Arguments

fp (str) – File path for output image