I found my message to Nathan, looks like I pressed the wrong reply button in the Outlook Express newsreader. I thought I'd forward it to the list since: a) we don't often discuss the turtle module and b) I ask a question at the end that I'd like an answer to! :-)
Alan G.----- Original Message ----- From: "Alan G" <[EMAIL PROTECTED]>
To: "Nathan Pinno" <[EMAIL PROTECTED]> Sent: Wednesday, July 27, 2005 10:15 PM Subject: Re: How do I make Python draw?
How do I make Python draw a shape? e.g. a triangle Is there a specific module that I have to call, or what is the command(s)?There are several options, most involve using a GUI framework to create a Canvas widget and drawing inside that. However for your purposes a more interesting route might be to trythe Python turtle module, it does the GUI bits for you and allows youto draw graphics by commanding a 'turtle' pen to move on the screen. If you know logo or any other turtle implementation it will be easy, if not an interesting lrearning experience and a fairly easy wauy of drawing basic geometric shapes...You can play with turtle by importing it at a >>> prompt and issueingcommands. Here is a session to draw an equilateral triangle:import turtle as t p = t.Pen() p.reset() p.down() for side in range(3):... p.forward(100) ... p.left(120) ... And attached is a jpeg of the resultant canvas. (The righward horizontal line seems to be a buglet in the module - does anyone know how to get rid of it?) HTH, Alan G.
<<attachment: turtle.jpg>>
_______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor