turtle graphics code example

Example 1: turtle circle() python

import turtle
t = turtle.Turtle()
t.color(color) # choose a color
t.begin_fill() # if you want it to be filled with color later
t.circle(10) # the function "circle" and the radious.
t.end_fill() # completing the filling of the circle. 
# try to do it and see if it works. it worked for me.

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
win = turtle.Screen()

Example 4: turtle module python

>>> player_one = turtle.Turtle()
>>> player_one.color("green")
>>> player_one.shape("turtle")
>>> player_one.penup()
>>> player_one.goto(-200,100)
>>> player_two = player_one.clone()
>>> player_two.color("blue")
>>> player_two.penup()
>>> player_two.goto(-200,-100)