turtle python shapes code example
Example 1: turtle circle() python
import turtle
t = turtle.Turtle()
t.color(color)
t.begin_fill()
t.circle(10)
t.end_fill()
Example 2: 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 3: how to import turtle in python
import turtle
Example 4: how to import turtle in python
import turtle
Example 5: turtle python
>>> tp = turtle.pos()
>>> tp
(0.00,0.00)
>>> turtle.setpos(60,30)
>>> turtle.pos()
(60.00,30.00)
>>> turtle.setpos((20,80))
>>> turtle.pos()
(20.00,80.00)
>>> turtle.setpos(tp)
>>> turtle.pos()
(0.00,0.00)