0

This code draws a few letters using turtle graphics:

import turtle
turtle.speed(1)
myWin = turtle.Screen()

turtle.left(90)
turtle.forward(260)
turtle.left(55)
turtle.forward(-60)
turtle.right(55)    
turtle.forward(-60)
turtle.right(55)
turtle.forward(-60)
turtle.left(100)
turtle.forward(-60)
turtle.right(45)    
turtle.forward(-60)
turtle.right(55)
turtle.forward(-50)
turtle.right(35)
turtle.forward(100)
turtle.left(90)
turtle.forward(260)
turtle.right(90)
turtle.forward(100)
turtle.right(90)
turtle.forward(100)
turtle.right(90)
turtle.forward(100)
turtle.right(50)
turtle.forward(-200)
turtle.right(130)
turtle.forward(50)
turtle.left(45)
turtle.forward(260)

myWin.exitonclick()

The problem is it starts drawing in the middle of the screen and I want it to start at the far left side. Is there any way to change the initial position

unor
  • 92,415
  • 26
  • 211
  • 360
David Rolfe
  • 163
  • 2
  • 10
  • 1
    possible duplicate of [python turtle set startpos](http://stackoverflow.com/questions/14713037/python-turtle-set-startpos) – twasbrillig Nov 19 '14 at 05:25

2 Answers2

1

Note that the turtle interface is a coordinate grid. so you can use the goto(x, y) function

turtle.penup()
turtle.goto(300,200)
turtle.pendown()
Taskinul Haque
  • 724
  • 2
  • 16
  • 36
0

Use turtle.penup to pick up the pen and move to the position you want, and then do turtle.pendown

ssm
  • 5,277
  • 1
  • 24
  • 42
  • I can't seem to use it right. Do you just say turtle.penup(position) and then turtle.pendown(position) – David Rolfe Nov 19 '14 at 06:02
  • 1
    do a `turtle.forward(10);turtle.penup();turtle.forward(10);turtle.pendown();turtle.forward(10)` and see what happens. – ssm Nov 19 '14 at 06:09
  • That didn't change the starting position (well it didn't seem to do anything) but what is it supposed to do? – David Rolfe Nov 19 '14 at 06:28
  • `penup()` will move the pen up. When you move (like `forward(100)` it will move the pen without drawing anything). Then when you have moved to the position you like, you can do a `pendown()`. So you can do `penup()` and then go to the corner, and then `pendown()` – ssm Nov 19 '14 at 06:32
  • Are you using iPython? Its better if you just try commands interactively first. – ssm Nov 19 '14 at 06:33