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()
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
def setup():
    states = py5.load_shape("us_map.svg")
    new_york = states.get_child("NY")
    ohio = new_york.find_child("OH")
    ohio.disable_style()

    py5.background(192)
    py5.scale(0.1)
    py5.translate(25, 225)
    py5.shape(states, 0, 0)
    py5.fill(255, 0, 0)
    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 Java method: PShape.findChild

Syntax

find_child(target: str, /) -> Py5Shape

Parameters

  • target: str - name of child object

Updated on September 11, 2021 16:51:34pm UTC