Primitives¶
Point¶
Graphical Size Class Definitions
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
andb
. Seepdpy_lib.primitives.point.Point
. The first two coordinates are the upper-left corner in Pointa
, and the second two are the lower-right corner in Pointb
.a ────────────────────┐ │ │ │ │ │ │ └──────────────────── b
- Parameters
coords (
list
) – The list of 4 coordinatesx1, y1, x2, y2
(defaults: Point, Point)json (
dict
) – The dictionary to populate the classxml (
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 classxml (
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
andPoint
. - dimension : next 2 floats are the Size. SeeSize
. - gop : next 1 int (0 or 1) defines if it must Graph-on-Parent. - margin : if present, next 2 floats are the margins. Seeaddmargin()
)