-
-
Notifications
You must be signed in to change notification settings - Fork 33
Using Turtle
Almenon edited this page Sep 6, 2021
·
2 revisions
First read https://github.com/Almenon/AREPL-vscode/wiki/Using-AREPL-with-GUI's
I suggest using the following code as a base:
import turtle
turtle.reset()
turtle.speed(0) # 0 is fastest. Accepts 1-10
turtle.setup(width=700, height=500, startx=-0, starty=0)
You can make the turtle go forward and turn like so:
# Add this below the base
turtle.forward(100)
turtle.left(95)
Do that 4 times and you've got a square!
Fun fact: With enough squares, you can make a circle:
def square():
turtle.forward(100)
turtle.left(95)
turtle.forward(100)
turtle.left(95)
turtle.forward(100)
turtle.left(95)
for i in range(50):
square()
turtle.left(5)