Simple utilities that extend Turtle
Project description
Simple utilities that extend the Turtle module
This code extends the turtle
module with context managers for the following tasks:
turtle.penup
turtle.pendown
turtle.color
turtle.pencolor
turtle.fillcolor
turtle.speed
turtle.fill
turtle.poly
turtle.pensize
disable_autoupdate
enable_autoupdate
In addition to a save_postscript
function to save the current canvas as an eps file.
Installation
pip install turtle-tools
Example
import turtle
import turtle_tools
turtle_tools.extend_turtle()
pen = turtle.Turtle()
with disable_autoupdate():
for i in range(2):
with pen.fill(), pen.color("blue", "green"):
for i in range(4):
pen.forward(100)
pen.right(90)
with pen.penup():
pen.forward(150)
with pen.pensize(5):
pen.right(90)
pen.penup()
pen.forward(200)
with pen.pendown():
pen.forward(100)
pen.right(90)
pen.forward(200)
pen.pendown()
pen.forward(200)
for i in range(2):
with pen.poly(), pen.color("red"):
for i in range(4):
pen.forward(100)
pen.right(90)
with pen.penup():
pen.forward(10)
save_postscript("file.eps")
turtle.done()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
turtle_tools-0.0.1.tar.gz
(3.7 kB
view hashes)
Built Distribution
Close
Hashes for turtle_tools-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f6c033fe34f3e99ab5fefeea850093574a31b36a71650531322d71e013fcff48 |
|
MD5 | c207ee98da73dec6f1d03c5f235313b7 |
|
BLAKE2b-256 | f946cc2d09e726cc3917cdf6df5fe9843dae0bb2141a4981c2b6c24f42a564d5 |