Py5Graphics.push_style()

The push_style() function saves the current style settings and Py5Graphics.pop_style() restores the prior settings.

Description

The push_style() function saves the current style settings and Py5Graphics.pop_style() restores the prior settings. Note that 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 Py5Graphics.pop_style() method pairs can be nested to provide more control. (See the second example for a demonstration.)

The style information controlled by the following functions are included in the style: Py5Graphics.fill(), Py5Graphics.stroke(), Py5Graphics.tint(), Py5Graphics.stroke_weight(), Py5Graphics.stroke_cap(), Py5Graphics.stroke_join(), Py5Graphics.image_mode(), Py5Graphics.rect_mode(), Py5Graphics.ellipse_mode(), Py5Graphics.shape_mode(), Py5Graphics.color_mode(), Py5Graphics.text_align(), Py5Graphics.text_font(), Py5Graphics.text_mode(), Py5Graphics.text_size(), Py5Graphics.text_leading(), Py5Graphics.emissive(), Py5Graphics.specular(), Py5Graphics.shininess(), and Py5Graphics.ambient().

This method is the same as push_style() but linked to a Py5Graphics object. To see example code for how it can be used, see push_style().

Underlying Java method: PGraphics.pushStyle

Syntax

push_style() -> None

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