Py5Shape.get_parent()#

Locate a child Py5Shape object’s parent GROUP Py5Shape object.

Examples#

example picture for get_parent()
1def setup():
2    p = py5.create_shape(py5.GROUP)
3    s1 = py5.create_shape(py5.RECT, 10, 10, 35, 35)
4    p.add_child(s1)
5    s2 = py5.create_shape(py5.RECT, 55, 10, 35, 35)
6    p.add_child(s2)
7    py5.shape(s2.get_parent())

Description#

Locate a child Py5Shape object’s parent GROUP Py5Shape object. This will return None if the shape has no parent, such as when the shape is the parent object or the shape is not a part of a group.

Underlying Processing method: PShape.getParent

Syntax#

get_parent() -> Py5Shape

Updated on November 12, 2021 11:30:58am UTC