Py5Shape.set_name()
Contents
Py5Shape.set_name()¶
Assign a name to a Py5Shape
object.
Examples¶

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | def setup():
s = py5.create_shape(py5.GROUP)
s1 = py5.create_shape(py5.RECT, 10, 10, 35, 35)
s1.set_name("rectangle1")
s.add_child(s1)
s2 = py5.create_shape(py5.RECT, 55, 10, 35, 35)
s2.set_name("rectangle2")
s.add_child(s2)
py5.shape(s)
s_child1 = s.get_child("rectangle1")
s_child1.set_fill("#FF0000")
s_child2 = s.get_child("rectangle2")
s_child2.set_fill("#00FF00")
py5.shape(s, 0, 45)
|
Description¶
Assign a name to a Py5Shape
object. This can be used to later find the shape in a GROUP
shape.
Underlying Processing method: PShape.setName
Syntax¶
set_name(name: str, /) -> None