← SPL reference

graphics (lib/graphics.py)

Turtle-style drawing backed by Python’s turtle module. Import with use graphics;, create a pen with graphics.icon, then call methods on your variable — same names as turtle (forward, right, penup, …). Statements still end with ;.

Requires a graphical display and tkinter for your Python build. Headless CI / Pyodide will not run the window.

Quick start

use graphics;

artist.setVar(graphics.icon);
#comment: or: artist <- graphics.icon;

artist.speed(5);
artist.forward(100);
artist.right(90);
artist.forward(100);
artist.done();

Factory & module helpers

Instance methods (turtle API)

Call on your variable: artist.method(...); Supports standard turtle names and short aliases:

Any other method name is forwarded to the underlying turtle.Turtle if it exists.

Example: examples/graphics_demo.spl