🧪 Version 0.2.2 is our alpha release candidate. Please send us bug reports and suggestions!

Sketchingpy

Creative coding and interactive science everywhere for everyone: web, desktop, mobile, Jupyter, and more. Open source!

Reference for pop_style

Restore a previously saved styling. This is part of the reference section.

Purpose

Restore the most recently saved styling configuration saved in style history, removing that styling from the history. This works as a stack (like a stack of plates) where the top of the pile is taken off and restored, removing it from that stack. This will overwrite the current style configuration in the sketch.

Snippet

Save a green fill and restore it later to draw a green rectangle.
sketch.set_fill('#00C000')  # Set fill to green
sketch.push_style()  # Save the current styling
sketch.set_fill('#C00000')  # Set it to red
sketch.pop_style()  # Restore saved styling so fill is green again
sketch.rect(50, 100, 150, 200)

Examples

Availability

Available on all platforms.

See also