Py5Shape.get_child_index()
Contents
Py5Shape.get_child_index()¶
Get a child Py5Shape
object’s index from a parent Py5Shape
object that is defined as a GROUP
.
Examples¶

1 2 3 4 5 6 7 8 9 10 | def setup():
us_map = py5.load_shape("us_map.svg")
for child in us_map.get_children():
idx = us_map.get_child_index(child)
py5.println(child.get_name(), idx)
py5.background(192)
py5.scale(0.1)
py5.translate(25, 225)
py5.shape(us_map, 0, 0)
|
Description¶
Get a child Py5Shape
object’s index from a parent Py5Shape
object that is defined as a GROUP
. Inside Processing, a group Py5Shape
object is an ordered list of child shapes. This method will retrieve the index for a particular child in that ordered list. That index value is useful when using other methods such as Py5Shape.get_child() or Py5Shape.remove_child().
Underlying Processing method: PShape.getChildIndex
Syntax¶
get_child_index(who: Py5Shape, /) -> int