Components#

class mhi.enerplot.Component(*, _ctx: Context | None = None, _ident: Dict[str, Any] | None = None)#

The base type for all Enerplot components.

Include graph frames, dividers, and sticky notes

property id: str#

The id of the component (read-only)

property book_name: str#

The book the component belongs to (read-only)

property book: Book#

The book the component belongs to (read-only)

property classid: str#

The classid of the component (read-only)

parent() Sheet#

Retrieve the owner of this component

attributes(**kwargs) Dict[str, Any]#

Set or get a component’s attributes

A component’s attributes are used to describe the component’s location and size relative to its parent.

Parameters:

**kwargs – key=value arguments

Returns:

The component’s current attributes.

See also

properties()

position() Tuple[int, int]#
position(x: int, y: int) None

Get or set the component’s position.

If the x & y parameters are given, the position is set. If they are omitted, the current position is returned.

Parameters:
  • x – The component’s new x location on the sheet

  • y – The component’s new y location on the sheet

Returns:

the current location of the component

size() Tuple[int, int]#
size(width: int, height: int) None

Get or set the component’s size

If the width & height parameters are given, the size is set. If they are omitted, the current size is returned.

Parameters:
  • width – The component’s new width

  • height – The component’s new height

Returns:

the current size of the component

extents() Tuple[int, int, int, int]#
extents(x: int, y: int, width: int, height: int) None

Get or set the component’s position and size

If all parameters are given, the position and size is set. If all parameters are omitted, the current extents are returned.

Parameters:
  • x – The component’s new x location on the sheet

  • y – The component’s new y location on the sheet

  • width – The component’s new width

  • height – The component’s new height

Returns:

the current extents of the component

properties(paramlist: str = '', **kwargs) Dict[str, Any]#

Set or get a component’s properties

A component’s properties are used to describe the component’s appearance or control the component’s behaviour.

Parameters:

**kwargs – key=value arguments

Returns:

The component’s current property values

See also

attributes()

copy_as_metafile() None#

Copy component to clipboard as a metafile

copy_as_bitmap() None#

Copy component to clipboard as a bitmap

cut() None#

Remove the component to the clipboard

copy() None#

Copy the component to the clipboard

paste() None#

Paste the component(s) from the clipboard to this canvas

list(classid: str | None = None) List[Component]#

List all the components contained inside this object, possibly restricted to a certain classid.

Parameters:

classid – one of “GraphFrame”, “PlotFrame”, “FFTFrame”, “Divider”, “Sticky” or “GroupBox”.

Returns:

the list of components

find([classid,] [key=value, ...])#

Find the (singular) component that matches the given criteria, or None if no matching component can be found. Raises an exception if more than one component matches the given criteria.

Parameters:
  • classid – one of “GraphFrame”, “PlotFrame”, “FFTFrame”, “Divider”, “Sticky” or “GroupBox”.

  • key=value – additional parameters which must be matched.

Returns:

the found component or None

find_first([classid,] [key=value, ...])#

Find a component that matches the given criteria, or None if no matching component can be found.

Parameters:
  • classid – one of “GraphFrame”, “PlotFrame”, “FFTFrame”, “Divider”, “Sticky” or “GroupBox”.

  • key=value – additional parameters which must be matched.

Returns:

the found component or None

find_all([classid,] [key=value, ...])#

Find all components that matches the given criteria, or None if no matching component can be found.

Parameters:
  • classid – one of “GraphFrame”, “PlotFrame”, “FFTFrame”, “Divider”, “Sticky” or “GroupBox”.

  • key=value – additional parameters which must be matched.

Returns:

the list of matching components

Lines#

class mhi.enerplot.Line(*, _ctx: Context | None = None, _ident: Dict[str, Any] | None = None)#

Divider Line

horizontal(width: int) Line#

Change the line to be horizontal, with the given length.

Parameters:

width – Length of the horizontal line

Returns:

to allow fluent-style chained commands.

vertical(height: int) Line#

Change the line to be vertical, with the given length.

Parameters:

width – Length of the horizontal line

Returns:

to allow fluent-style chained commands.

flat(style: str | None = None, weight: str | None = None, colour: str | None = None) Line#

Change the line to be a “flat” (non-3D) line. Optionally change the line’s style, weight and/or colour.

Parameters:
  • style – new style Solid, Dash, Dot or DotDash

  • weight – new weight ("0.2 pt" to "1.4 pt" in increments of 0.2 pt)

  • colour – new colour ("red", "#FF0000", …)

Returns:

to allow fluent-style chained commands.

solid(weight: str | None = None, colour: str | None = None) Line#

Change the line to be a solid, non-3D line. Optionally change the line’s weight and/or colour.

Parameters:
  • weight – new weight ("0.2 pt" to "1.4 pt" in increments of 0.2 pt)

  • colour – new colour ("red", "#FF0000", …)

Returns:

to allow fluent-style chained commands.

dashed(weight: str | None = None, colour: str | None = None) Line#

Change the line to be a dashed, non-3D line. Optionally change the line’s weight and/or colour.

Parameters:
  • weight – new weight ("0.2 pt" to "1.4 pt" in increments of 0.2 pt)

  • colour – new colour ("red", "#FF0000", …)

Returns:

to allow fluent-style chained commands.

dotted(weight: str | None = None, colour: str | None = None) Line#

Change the line to be a dotted, non-3D line. Optionally change the line’s weight and/or colour.

Parameters:
  • weight – new weight ("0.2 pt" to "1.4 pt" in increments of 0.2 pt)

  • colour – new colour ("red", "#FF0000", …)

Returns:

to allow fluent-style chained commands.

dot_dash(weight: str | None = None, colour: str | None = None) Line#

Change the line to be a dot-dashed, non-3D line. Optionally change the line’s weight and/or colour.

Parameters:
  • weight – new weight ("0.2 pt" to "1.4 pt" in increments of 0.2 pt)

  • colour – new colour ("red", "#FF0000", …)

Returns:

self, to allow fluent-style chained commands.

raised(colour: str | None = None) Line#

Change the line to be a raised, 3D line. Optionally change the line’s colour.

Parameters:

colour – new colour ("red", "#FF0000", …)

Returns:

self, to allow fluent-style chained commands.

attributes(**kwargs) Dict[str, Any]#

Set or get a component’s attributes

A component’s attributes are used to describe the component’s location and size relative to its parent.

Parameters:

**kwargs – key=value arguments

Returns:

The component’s current attributes.

See also

properties()

property book: Book#

The book the component belongs to (read-only)

property book_name: str#

The book the component belongs to (read-only)

property classid: str#

The classid of the component (read-only)

copy() None#

Copy the component to the clipboard

copy_as_bitmap() None#

Copy component to clipboard as a bitmap

copy_as_metafile() None#

Copy component to clipboard as a metafile

cut() None#

Remove the component to the clipboard

extents(x: int | None = None, y: int | None = None, width: int | None = None, height: int | None = None) Tuple[int, int, int, int] | None#

Get or set the component’s position and size

If all parameters are given, the position and size is set. If all parameters are omitted, the current extents are returned.

Parameters:
  • x – The component’s new x location on the sheet

  • y – The component’s new y location on the sheet

  • width – The component’s new width

  • height – The component’s new height

Returns:

the current extents of the component

find([classid,] [key=value, ...])#

Find the (singular) component that matches the given criteria, or None if no matching component can be found. Raises an exception if more than one component matches the given criteria.

Parameters:
  • classid – one of “GraphFrame”, “PlotFrame”, “FFTFrame”, “Divider”, “Sticky” or “GroupBox”.

  • key=value – additional parameters which must be matched.

Returns:

the found component or None

find_all([classid,] [key=value, ...])#

Find all components that matches the given criteria, or None if no matching component can be found.

Parameters:
  • classid – one of “GraphFrame”, “PlotFrame”, “FFTFrame”, “Divider”, “Sticky” or “GroupBox”.

  • key=value – additional parameters which must be matched.

Returns:

the list of matching components

find_first([classid,] [key=value, ...])#

Find a component that matches the given criteria, or None if no matching component can be found.

Parameters:
  • classid – one of “GraphFrame”, “PlotFrame”, “FFTFrame”, “Divider”, “Sticky” or “GroupBox”.

  • key=value – additional parameters which must be matched.

Returns:

the found component or None

property id: str#

The id of the component (read-only)

list(classid: str | None = None) List[Component]#

List all the components contained inside this object, possibly restricted to a certain classid.

Parameters:

classid – one of “GraphFrame”, “PlotFrame”, “FFTFrame”, “Divider”, “Sticky” or “GroupBox”.

Returns:

the list of components

property main: Enerplot#

A reference to the Application object that returned this Remotable object.

parent() Sheet#

Retrieve the owner of this component

paste() None#

Paste the component(s) from the clipboard to this canvas

position(x: int | None = None, y: int | None = None) Tuple[int, int] | None#

Get or set the component’s position.

If the x & y parameters are given, the position is set. If they are omitted, the current position is returned.

Parameters:
  • x – The component’s new x location on the sheet

  • y – The component’s new y location on the sheet

Returns:

the current location of the component

properties(paramlist: str = '', **kwargs) Dict[str, Any]#

Set or get a component’s properties

A component’s properties are used to describe the component’s appearance or control the component’s behaviour.

Parameters:

**kwargs – key=value arguments

Returns:

The component’s current property values

See also

attributes()

size(width: int | None = None, height: int | None = None) Tuple[int, int] | None#

Get or set the component’s size

If the width & height parameters are given, the size is set. If they are omitted, the current size is returned.

Parameters:
  • width – The component’s new width

  • height – The component’s new height

Returns:

the current size of the component

Text#

class mhi.enerplot.TextArea(*, _ctx: Context | None = None, _ident: Dict[str, Any] | None = None)#

Text Area - Sticky Notes & Captions

property text: Any#

Text in the text area

colour(foreground: str | None = None, background: str | None = None) TextArea#

Alter the foreground and/or background colours of the Text Area.

Parameters:
  • foreground – Desired foreground colour

  • background – Desired foreground colour

Returns:

to allow fluent-style chained commands.

arrows() str#
arrows(*args: str, add: str | Sequence[str] | None = None, remove: str | Sequence[str] | None = None) TextArea

Get or set the arrows on the Text Area.

With no arguments, the current arrows are returned as a string.

If any positional arguments are given, the arrows are set to the indicated directions only.

If the add keyword argument is specified, these arrows are added on the text area, joining any existing arrows.

If the remove keyword argument is specified, these arrows are removed from the text area.

The direction arrows may be given as iterable group of strings, or as a space-separated string.

Parameters:
  • *args – arrow directions to set on the Text Area

  • add – arrow directions to add to the Text Area

  • remove – arrow directions to remove from the Text Area

Returns:

a string describing the current arrow configuration, or self, to allow fluent-style chained commands

Examples:

note.arrows("N", "NE")  # Set North & North-East arrows only.
note.arrows("N NE")     # Set North & North-East arrows only.
note.arrows(add="N NE") # Add the North & North-East arrows.
note.arrows(remove=("N", "NE")) # Remove those arrows.
attributes(**kwargs) Dict[str, Any]#

Set or get a component’s attributes

A component’s attributes are used to describe the component’s location and size relative to its parent.

Parameters:

**kwargs – key=value arguments

Returns:

The component’s current attributes.

See also

properties()

property book: Book#

The book the component belongs to (read-only)

property book_name: str#

The book the component belongs to (read-only)

property classid: str#

The classid of the component (read-only)

copy() None#

Copy the component to the clipboard

copy_as_bitmap() None#

Copy component to clipboard as a bitmap

copy_as_metafile() None#

Copy component to clipboard as a metafile

cut() None#

Remove the component to the clipboard

extents(x: int | None = None, y: int | None = None, width: int | None = None, height: int | None = None) Tuple[int, int, int, int] | None#

Get or set the component’s position and size

If all parameters are given, the position and size is set. If all parameters are omitted, the current extents are returned.

Parameters:
  • x – The component’s new x location on the sheet

  • y – The component’s new y location on the sheet

  • width – The component’s new width

  • height – The component’s new height

Returns:

the current extents of the component

find([classid,] [key=value, ...])#

Find the (singular) component that matches the given criteria, or None if no matching component can be found. Raises an exception if more than one component matches the given criteria.

Parameters:
  • classid – one of “GraphFrame”, “PlotFrame”, “FFTFrame”, “Divider”, “Sticky” or “GroupBox”.

  • key=value – additional parameters which must be matched.

Returns:

the found component or None

find_all([classid,] [key=value, ...])#

Find all components that matches the given criteria, or None if no matching component can be found.

Parameters:
  • classid – one of “GraphFrame”, “PlotFrame”, “FFTFrame”, “Divider”, “Sticky” or “GroupBox”.

  • key=value – additional parameters which must be matched.

Returns:

the list of matching components

find_first([classid,] [key=value, ...])#

Find a component that matches the given criteria, or None if no matching component can be found.

Parameters:
  • classid – one of “GraphFrame”, “PlotFrame”, “FFTFrame”, “Divider”, “Sticky” or “GroupBox”.

  • key=value – additional parameters which must be matched.

Returns:

the found component or None

property id: str#

The id of the component (read-only)

list(classid: str | None = None) List[Component]#

List all the components contained inside this object, possibly restricted to a certain classid.

Parameters:

classid – one of “GraphFrame”, “PlotFrame”, “FFTFrame”, “Divider”, “Sticky” or “GroupBox”.

Returns:

the list of components

property main: Enerplot#

A reference to the Application object that returned this Remotable object.

parent() Sheet#

Retrieve the owner of this component

paste() None#

Paste the component(s) from the clipboard to this canvas

position(x: int | None = None, y: int | None = None) Tuple[int, int] | None#

Get or set the component’s position.

If the x & y parameters are given, the position is set. If they are omitted, the current position is returned.

Parameters:
  • x – The component’s new x location on the sheet

  • y – The component’s new y location on the sheet

Returns:

the current location of the component

properties(paramlist: str = '', **kwargs) Dict[str, Any]#

Set or get a component’s properties

A component’s properties are used to describe the component’s appearance or control the component’s behaviour.

Parameters:

**kwargs – key=value arguments

Returns:

The component’s current property values

See also

attributes()

size(width: int | None = None, height: int | None = None) Tuple[int, int] | None#

Get or set the component’s size

If the width & height parameters are given, the size is set. If they are omitted, the current size is returned.

Parameters:
  • width – The component’s new width

  • height – The component’s new height

Returns:

the current size of the component

class mhi.enerplot.GroupBox(*, _ctx: Context | None = None, _ident: Dict[str, Any] | None = None)#

A group box which may be placed on a user canvas, to visually show components which are related to each other.

Group Box Parameters#

Param Name

Type

Description

name

str

Name of the group box

show_name

bool

Show or Hide the group name

font

Font

Font

line_style

str

Border style: SOLID, DASH, DOT, DASHDOT

line_colour

Color

Colour of the group box border

line_weight

str

Border Weight: 0.2, 0.4, 0.6, 0.8, 1.0, 1.2, 1.4

fill_style

str

Fill style of the group box interior

fill_fg

Color

Colour of foreground fill

fill_bg

Color

Colour of background fill

Added in version 2.9.

attributes(**kwargs) Dict[str, Any]#

Set or get a component’s attributes

A component’s attributes are used to describe the component’s location and size relative to its parent.

Parameters:

**kwargs – key=value arguments

Returns:

The component’s current attributes.

See also

properties()

property book: Book#

The book the component belongs to (read-only)

property book_name: str#

The book the component belongs to (read-only)

property classid: str#

The classid of the component (read-only)

copy() None#

Copy the component to the clipboard

copy_as_bitmap() None#

Copy component to clipboard as a bitmap

copy_as_metafile() None#

Copy component to clipboard as a metafile

cut() None#

Remove the component to the clipboard

extents(x: int | None = None, y: int | None = None, width: int | None = None, height: int | None = None) Tuple[int, int, int, int] | None#

Get or set the component’s position and size

If all parameters are given, the position and size is set. If all parameters are omitted, the current extents are returned.

Parameters:
  • x – The component’s new x location on the sheet

  • y – The component’s new y location on the sheet

  • width – The component’s new width

  • height – The component’s new height

Returns:

the current extents of the component

find([classid,] [key=value, ...])#

Find the (singular) component that matches the given criteria, or None if no matching component can be found. Raises an exception if more than one component matches the given criteria.

Parameters:
  • classid – one of “GraphFrame”, “PlotFrame”, “FFTFrame”, “Divider”, “Sticky” or “GroupBox”.

  • key=value – additional parameters which must be matched.

Returns:

the found component or None

find_all([classid,] [key=value, ...])#

Find all components that matches the given criteria, or None if no matching component can be found.

Parameters:
  • classid – one of “GraphFrame”, “PlotFrame”, “FFTFrame”, “Divider”, “Sticky” or “GroupBox”.

  • key=value – additional parameters which must be matched.

Returns:

the list of matching components

find_first([classid,] [key=value, ...])#

Find a component that matches the given criteria, or None if no matching component can be found.

Parameters:
  • classid – one of “GraphFrame”, “PlotFrame”, “FFTFrame”, “Divider”, “Sticky” or “GroupBox”.

  • key=value – additional parameters which must be matched.

Returns:

the found component or None

property id: str#

The id of the component (read-only)

list(classid: str | None = None) List[Component]#

List all the components contained inside this object, possibly restricted to a certain classid.

Parameters:

classid – one of “GraphFrame”, “PlotFrame”, “FFTFrame”, “Divider”, “Sticky” or “GroupBox”.

Returns:

the list of components

property main: Enerplot#

A reference to the Application object that returned this Remotable object.

parent() Sheet#

Retrieve the owner of this component

paste() None#

Paste the component(s) from the clipboard to this canvas

position(x: int | None = None, y: int | None = None) Tuple[int, int] | None#

Get or set the component’s position.

If the x & y parameters are given, the position is set. If they are omitted, the current position is returned.

Parameters:
  • x – The component’s new x location on the sheet

  • y – The component’s new y location on the sheet

Returns:

the current location of the component

properties(paramlist: str = '', **kwargs) Dict[str, Any]#

Set or get a component’s properties

A component’s properties are used to describe the component’s appearance or control the component’s behaviour.

Parameters:

**kwargs – key=value arguments

Returns:

The component’s current property values

See also

attributes()

size(width: int | None = None, height: int | None = None) Tuple[int, int] | None#

Get or set the component’s size

If the width & height parameters are given, the size is set. If they are omitted, the current size is returned.

Parameters:
  • width – The component’s new width

  • height – The component’s new height

Returns:

the current size of the component