Primitives

Point

class pdpy_lib.primitives.point.Point(x=None, y=None, json=None, xml=None)[source]

Bases: Base

increment(x, y)[source]
set_x(x)[source]
set_y(y)[source]

Graphical Size Class Definitions

class pdpy_lib.primitives.size.Size(w=None, h=None, json=None, xml=None)[source]

Bases: Base

set_height(height)[source]
set_width(width)[source]

Area

class pdpy_lib.primitives.area.Area(coords=None, json=None, xml=None)[source]

Bases: Base

Represents a rectangular section of the screen

The area is represented with two points, a and b. See pdpy_lib.primitives.point.Point. The first two coordinates are the upper-left corner in Point a, and the second two are the lower-right corner in Point b.

a ────────────────────┐
│                     │
│                     │
│                     │
└──────────────────── b
Parameters
  • coords (list) – The list of 4 coordinates x1, y1, x2, y2 (defaults: Point, Point)

  • json (dict) – The dictionary to populate the class

  • xml (xml.etree.ElementTree.Element) – The XML Element with two sub-elements for each point <a> and <b>

Example

This example imports and calls the class with the coords keywords

>>> import pdpy_lib as pdpy
>>> area = pdpy.Area(coords=[0,0,10,10])

The default pd-lang string interleaves the coords, getting x1,x2,y1,y2

>>> area.__pd__()
'0 10 0 10'

If there is an order argument, coords remain the same: x1,y1,x2,y2

>>> area.__pd__(order=1)
'0 0 10 10'

The XML Element is accessed like this

>>> area.__xml__()
<Element 'area' at 0x1024379f0>

Bounds

class pdpy_lib.primitives.bounds.Bounds(lower=None, upper=None, dtype=<class 'float'>, json=None, xml=None)[source]

Bases: Base

Lower and upper bounds for GUI objects

Parameters
  • lower (dtype or None) – The lower (minima) of the boundary (defaults: 0)

  • upper (dtype or None) – The upper (maxima) of the boundary (defaults: 0)

  • dtype (class) – Class to define bound value type (defaults: float)

  • json (dict or None) – A json representation of the bounds class

  • xml (xml.etree.ElementTree.Element or None) – The XML Element with two sub-elements for each boundary <lower> and <upper>

Coords

class pdpy_lib.primitives.coords.Coords(coords=None, json=None, xml=None, **kwargs)[source]

Bases: Base

Coordinates of a Pd Patch

The coordinates of the Pd Patch takes a list of 7 or 9 arguments Created in the following format: - range : first 4 floats are the Area. Defined by 2 Points. See Area and Point. - dimension : next 2 floats are the Size. See Size. - gop : next 1 int (0 or 1) defines if it must Graph-on-Parent. - margin : if present, next 2 floats are the margins. See addmargin())

addmargin(**kwargs)[source]

Adds the margins to the coords class