Saving output of Turtle Graphics?
Dick Moores
rdm at rcblue.com
Sat Apr 7 11:37:08 EDT 2007
At 06:50 AM 4/7/2007, =?ISO-8859-2?Q?Wojciech_Mu=B3a?= wrote:
>Dick Moores wrote:
> > I accidentally stumbled across the Turtle Graphics module (turtle.py)
> > the other day and have been having some fun with it.
> >
> > Now I'm wondering if there is a way to build into a script the saving of
> > each window just before it is cleared. For example, here are a couple
> > that I've saved by screen capture:
> > <http://www.rcblue.com/Misc/RandomTriangles.jpg>
> > <http://www.rcblue.com/Misc/RandomTriangles2.jpg>
>
>Turtle module uses Tk canvas element to draw graphics ('_canvas'
>attribute). I've written module, that exports canvas graphics to SVG
>file: http://wmula.republika.pl/proj/canvas2svg/ -- it may be useful
>for you.
I afraid I'm totally unfamiliar with SVG. Would it be possible for
you or someone else on the list to show how to use your module to
export the simple product of this simple script to an SVG file?
===============================================
import turtle as T
from random import randint
T.setup(width=1000, height=700, startx=0, starty=0)
T.color(1, .5, .5)
T.begin_fill()
# 2 connected lines will fill as a triangle
for x in range(2):
coord = (randint(-500,500), randint(-350,350))
T.goto(coord)
T.end_fill()
T.done()
================================================
Thanks,
Dick Moores
Win XP Pro SP2
Python 2.5
Python IDE: Ulipad 3.6
More information about the Python-list
mailing list