b = turtle.Turtle() b.forward(100) b.left(120) b.forward(100) b.left(120) b.forward(100) code example
Example 1: create a window turtle python
import turtle
wn = turtle.Screen()
wn.setup(800, 600)
wn.bgcolor("black")
wn.title("Window")
while True:
window.update()
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()