Skip to main content

Use the Python turtle to write SVG files. With optional IPython integration.

Project description

SaVaGe Turtle Build Badge Coverage Badge Downloads Badge PyPI Badge Supported Python versions

Use the Python turtle to write SVG files

If you're using the Python turtle module to teach students, or you just like using the turtle module yourself, this library can save the images from a turtle script as SVG files. Experiment with your turtle code using the regular turtle or the Live Coding in Python plugin for PyCharm, then pass an SvgTurtle to the same code, and save it as an SVG file. If you want to produce other file formats, use svglib to convert the SVG to PDF, PNG, GIF, JPG, TIFF, and PCT, among others.

Installing

Install it with pip install svg_turtle. If you haven't installed Python packages before, read Brett Cannon's quick-and-dirty guide.

Drawing

Once it's installed, create an SvgTurtle, telling it how big to make the SVG file. Then give it some turtle commands, and save the file.

from svg_turtle import SvgTurtle

t = SvgTurtle(500, 500)
t.forward(200)
t.dot(10)
t.save_as('example.svg')

IPythonTurtle

To use SvgTurtle with IPython integration, create an instance of the IPythonTurtle class. It exposes the same interface as SvgTurtle. It implements both display on implicit return, and explicit display via the show() method.

from svg_turtle import IPythonTurtle

t = IPythonTurtle(500, 500)
t.forward(200)
t.show()                    # explicit display
t.dot(10)
t                           # display via implicit return

More Information

If you'd like to help out with the project, see the CONTRIBUTING.md file in the source code.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

svg_turtle-1.2.0.tar.gz (15.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

svg_turtle-1.2.0-py3-none-any.whl (13.0 kB view details)

Uploaded Python 3

File details

Details for the file svg_turtle-1.2.0.tar.gz.

File metadata

  • Download URL: svg_turtle-1.2.0.tar.gz
  • Upload date:
  • Size: 15.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for svg_turtle-1.2.0.tar.gz
Algorithm Hash digest
SHA256 babfc15c8b70553655b2bb29238e10c83fc0c270c460e2430621d5f248f5e896
MD5 ad62a07020eaddabd12aa9b145930d72
BLAKE2b-256 d47f510060ea4e55be254761d79cfb3562edf79d9e6d0bf3a2c3e4092d526bb4

See more details on using hashes here.

File details

Details for the file svg_turtle-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: svg_turtle-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 13.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for svg_turtle-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 61a7829594cdd1b954644d6caa66a4b767ff34da02d6b2fd8ce286c098b96125
MD5 1872bb51fdffd732132a782f505857bd
BLAKE2b-256 3e35e07f066f25701529d57c0bba2bd7e4bc70682d679cae9e9036b632ebed4d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page