Py5Shape.get_parent()

Py5Shape.get_parent()

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

Examples

example picture for get_parent()
1
2
3
4
5
6
7
def setup():
    p = py5.create_shape(py5.GROUP)
    s1 = py5.create_shape(py5.RECT, 10, 10, 35, 35)
    p.add_child(s1)
    s2 = py5.create_shape(py5.RECT, 55, 10, 35, 35)
    p.add_child(s2)
    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