Py5Shape.find_child()#

Find a target Py5Shape object from anywhere within a Py5Shape object that is defined as a GROUP.

Examples#

example picture for find_child()
 1def setup():
 2    states = py5.load_shape("us_map.svg")
 3    new_york = states.get_child("NY")
 4    ohio = new_york.find_child("OH")
 5    ohio.disable_style()
 6
 7    py5.background(192)
 8    py5.scale(0.1)
 9    py5.translate(25, 225)
10    py5.shape(states, 0, 0)
11    py5.fill(255, 0, 0)
12    py5.shape(ohio, 0, 0)

Description#

Find a target Py5Shape object from anywhere within a Py5Shape object that is defined as a GROUP. This is similar to Py5Shape.get_child() in that it locates a child Py5Shape object, except that it can start the search from another child shape instead of the parent.

Underlying Processing method: PShape.findChild

Syntax#

find_child(target: str, /) -> Py5Shape

Parameters#

  • target: str - name of child object

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