turtle commands python code example
Example 1: turtle python
from turtle import *
color('red', 'yellow')
begin_fill()
while True:
forward(200)
left(170)
if abs(pos()) < 1:
break
end_fill()
done()
Example 2: python turtle example
import turtle
bob = turtle.Turtle()
bob.forward(50)
turtle.done()
Example 3: turtle with python
import turtle
t = turtle.Turtle()
t.forward(100)
t.color('blue')
t.right(90)
t.forward(100)
t.right(90)
t.forward(100)
t.right(90)
t.forward(100)
Example 4: python turtle tutorial
>>> turtle.pos()
(440.00,-0.00)
Example 5: python turtle tutorial
>>> turtle.position()
(0.00,240.00)
>>> turtle.setx(10)
>>> turtle.position()
(10.00,240.00)
Example 6: python turtle tutorial
>>> s = turtle.getscreen()