boxes.constrain

align(edges, *boxes) Aligns boxes along the specified edges.
row(*boxes[, spacing]) Place the given boxes along a horizontal row with the given spacing between them.
column(*boxes[, spacing]) Place the given boxes along a vertical column with the given spacing between them.
hcat(*boxes[, spacing]) Similar to column() but does not constrain top and bottom edges in any way.
vcat(*boxes[, spacing]) Similar to row() but does not constrain left and right edges in any way.
aspect(aspect, *boxes) Constrain every box in boxes to have the given aspect ratio.
width(width, *boxes) Constrain the width of every box in boxes
height(height, *boxes) Constrain the height of every box in boxes
size(size, *boxes) Constrain the size of every box in boxes
boxes.constrain.align(edges, *boxes)

Aligns boxes along the specified edges.

This function adds contraints aligning the given boxes along edges specified in the following manner:

  • If 't' is in edges, equate the y-coordinates of the top edges of every box in boxes.
  • If 'r' is in edges, equate the x-coordinates of the right edges of every box in boxes.
  • If 'b' is in edges, equate the y-coordinates of the bottom edges of every box in boxes.
  • If 'l' is in edges, equate the x-coordinates of the left edges of every box in boxes.
Parameters:
  • edges (str) – Any combination of the letters 't', 'r', 'b', and 'l'.
  • boxes – The Box objects to align.
boxes.constrain.row(*boxes, spacing=0)

Place the given boxes along a horizontal row with the given spacing between them. The boxes will align along the top and bottom edges.

Parameters:
  • boxes – The Box objects to put in a row.
  • spacing – The spacing between the boxes (this can be a float or an Expr).
boxes.constrain.column(*boxes, spacing=0)

Place the given boxes along a vertical column with the given spacing between them. The boxes will align along the left and right edges.

Parameters:
  • boxes – The Box objects to put in a column.
  • spacing (a float or an Expr) – The spacing between the boxes.
boxes.constrain.hcat(*boxes, spacing=0)

Similar to column() but does not constrain top and bottom edges in any way.

Parameters:
  • boxesBox objects.
  • spacing (a float or an Expr) – The spacing between the boxes.
boxes.constrain.vcat(*boxes, spacing=0)

Similar to row() but does not constrain left and right edges in any way.

Parameters:
  • boxesBox objects.
  • spacing (a float or an Expr) – The spacing between the boxes.
boxes.constrain.aspect(aspect, *boxes)

Constrain every box in boxes to have the given aspect ratio.

Parameters:
  • aspect (float) – The aspect ratio is defined as the width divided by the height.
  • boxesBox objects.
boxes.constrain.width(width, *boxes)

Constrain the width of every box in boxes

Parameters:
  • width – A float or an Expr object.
  • boxesBox objects.
boxes.constrain.height(height, *boxes)

Constrain the height of every box in boxes

Parameters:
  • height – A float or an Expr object.
  • boxesBox objects.
boxes.constrain.size(size, *boxes)

Constrain the size of every box in boxes

Parameters:
  • size – A float or an Expr object.
  • boxesBox objects.