[Tutor] Help with printing turtle Graphics

Alan Gauld alan.gauld at yahoo.co.uk
Sat Oct 24 19:46:29 EDT 2020


On 24/10/2020 19:57, Gerald OBrien wrote:

> I tried to print it, using a Printer,  or save it as either a jpeg or PNG suffix 

I can't thin of an easy way to do this ids a window capture doesn't work.

In code you can save a screen object as a postscript file but
it involves some non-trivial Tkinter knowledge and functions.
The turtle screen object is descended from the Tkinter canvas
object which has a "Postscript(....)" method.

If you feel keen read up on how to use the postscript method.
You can get the screen object by calling turtle.Screen() so...

scr = turtle.Screen()
scr.Postscript('myturtle.ps')


Should, in theory, work, but I suspect its more complex than that!
Then you need to find a way to print or view a postscript file.
You might need a Mac user to tell you how to do that...

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos




More information about the Tutor mailing list