[Tutor] Function help

Alan Gauld alan.gauld at btinternet.com
Mon Feb 24 09:47:29 CET 2014


On 24/02/14 02:04, Scott W Dunning wrote:

> *Also, does anyone know anything about turtle where I can try and move
> the starting point to the upper left hand corner? *

dir() and help() are your friends.
After doing dir(turtle) I spooted this likely looking candidate and ran 
help on it:

--------------
setposition(x, y=None)
     Move turtle to an absolute position.

     Aliases: setpos | setposition | goto:

     Arguments:
     x -- a number      or     a pair/vector of numbers
     y -- a number             None

     call: goto(x, y)         # two coordinates
     --or: goto((x, y))       # a pair (tuple) of coordinates
     --or: goto(vec)          # e.g. as returned by pos()

     Move turtle to an absolute position. If the pen is down,
     a line will be drawn. The turtle's orientation does not change.
etc
--------------


Similarly, I found the window_width() and window_height() methods.

So, to get to the top left corner you'd

goto( -window_width/2, window_height/2 )

HTH

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.flickr.com/photos/alangauldphotos



More information about the Tutor mailing list