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

Bases: pinout.core.Layout

Basis of a pinout diagram

  • 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.

  • path (string) – Path to stylesheet file

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


Render children into an <svg> tag.


SVG markup

Return type



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.

  • width (int) – Width of component

  • height (int) – Height of component

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