Layout

Diagram

class pinout.components.layout.Diagram(width, height, tag=None, **kwargs)

Bases: pinout.core.Layout

Basis of a pinout diagram

Parameters
  • width (int) – width of diagram

  • height (int) – height of diagram

  • tag (string (must comply to CSS naming rules), optional) – CSS class applied to diagram, defaults to None

add_stylesheet(path, embed=False)

Add a stylesheet to the diagram

Pinout relies on cascading-style-sheet (CSS) rules to control presentation attributes of components.

The path attribute is dependent on whether the styles are linked or embedded. When linked, the path is relative to the exported file. When embedded the path is relative to the diagram script file.

Parameters
  • path (string) – Path to stylesheet file

  • embed (bool, optional) – embed stylesheet in exported file, defaults to True

render()

Render children into an <svg> tag.

Returns

SVG markup

Return type

string

Panel

class pinout.components.layout.Panel(width, height, inset=None, **kwargs)

Bases: pinout.core.Layout

The basic building block to control layout (grouping and location) of components that make up a complete diagram document. The Panel component renders two rectangles - and outer and inner rectangle - behind all child components to assist with graphical styling.

The inset attribute controls dimensions of the ‘inner rectangle’. All children are aligned relative to the inset coordinate (x1, y1).

The inner dimensions can be accessed via the properties Panel.inset_width and Panel.inset_height.

Parameters
  • width (int) – Width of component

  • height (int) – Height of component

  • inset (Tuple (x1, y1, x2, y2), optional) – Inset of inner dimensions, defaults to None