pop_style()#

The push_style() function saves the current style settings and pop_style() restores the prior settings; these functions are always used together.

Examples#

example picture for pop_style()
 1def setup():
 2    py5.ellipse(0, 50, 33, 33)  # left circle
 3
 4    py5.push_style()  # start a new style
 5    py5.stroke_weight(10)
 6    py5.fill(204, 153, 0)
 7    py5.ellipse(50, 50, 33, 33)  # middle circle
 8    py5.pop_style()  # restore original style
 9
10    py5.ellipse(100, 50, 33, 33)  # right circle
example picture for pop_style()
 1def setup():
 2    py5.ellipse(0, 50, 33, 33)  # left circle
 3
 4    py5.push_style()  # start a new style
 5    py5.stroke_weight(10)
 6    py5.fill(204, 153, 0)
 7    py5.ellipse(33, 50, 33, 33)  # left-middle circle
 8
 9    py5.push_style()  # start another new style
10    py5.stroke(0, 102, 153)
11    py5.ellipse(66, 50, 33, 33)  # right-middle circle
12    py5.pop_style()  # restore the previous style
13
14    py5.pop_style()  # restore original style
15
16    py5.ellipse(100, 50, 33, 33)  # right circle

Description#

The push_style() function saves the current style settings and pop_style() restores the prior settings; these functions are always used together. They allow you to change the style settings and later return to what you had. When a new style is started with push_style(), it builds on the current style information. The push_style() and pop_style() method pairs can be nested to provide more control (see the second example for a demonstration.)

Underlying Processing method: popStyle

Syntax#

pop_style() -> None

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