Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

how to run turtle in python

	#import turtle
import turtle

b=turtle.Pen()
b.speed(50)

for i in range(4):
    for i in range(4):
        for i in range(4):
            for i in range(8):
                for i in range(3):
                    for i in range(6):
                        b.fd(10)
                        b.lt(60)

                    b.lt(120)

                b.fd(30)

            for i in range(2):
                b.lt(90)
                b.fd(30)

            b.lt(-90)

        b.fd(10)
        b.lt(90)

    b.fd(200)
    b.lt(90)
Comment

install turtle command

$ pip install turtle
Comment

python turtle commands

"""
TURTLE COMMANDS
command       shortcut      makes the turtle """
goto(x, y)    setpos(x, y)  # go to x, y coordinates
forward(d)    fd(d)         # go forward d units
back(d)       bk(d)         # go backward d units
left(a)       lt(a)         # rotate left a degrees
right(a)      rt(a)         # rotate right a degrees
setheading(h) seth(h)       # set heading to h degrees

write(text)                 # write text in the screen
Comment

python turtle

import turtle
myTurtle = turtle.Turtle()

myTurtle.forward(100)
myTurtle.right(90)
myTurtle.forward(100)
Comment

python turtle tutorial

>>> turtle.position()
(0.00,240.00)
>>> turtle.setx(10)
>>> turtle.position()
(10.00,240.00)
Comment

python turtle tutorial

>>> turtle.heading()
22.0
>>> turtle.right(45)
>>> turtle.heading()
337.0
Comment

python turtle

import turtle
tina=turtle.Turtle()
#trinket.io specializes in these stuff
Comment

python turtle tutorial

>>> turtle.heading()
22.0
>>> turtle.left(45)
>>> turtle.heading()
67.0
Comment

python turtle tutorial

>>> turtle.pos()
(440.00,-0.00)
Comment

python turtle tutorial

>>> turtle.position()
(0.00,0.00)
>>> turtle.backward(30)
>>> turtle.position()
(-30.00,0.00)
Comment

python turtle tutorial

>>> turtle.position()
(0.00,0.00)
>>> turtle.forward(25)
>>> turtle.position()
(25.00,0.00)
>>> turtle.forward(-75)
>>> turtle.position()
(-50.00,0.00)
Comment

python turtle tutorial

>>> turtle.position()
(0.00,40.00)
>>> turtle.sety(-10)
>>> turtle.position()
(0.00,-10.00)
Comment

python turtle tutorial

>>> turtle.heading()
90.0
>>> turtle.position()
(0.00,-10.00)
>>> turtle.home()
>>> turtle.position()
(0.00,0.00)
>>> turtle.heading()
0.0
Comment

python turtle tutorial

>>> turtle.setheading(90)
>>> turtle.heading()
90.0
Comment

python turtle tutorial

>>> turtle.color("blue")
>>> turtle.stamp()
11
>>> turtle.fd(50)
Comment

python turtle tutorial

>>> turtle.speed()
3
>>> turtle.speed('normal')
>>> turtle.speed()
6
>>> turtle.speed(9)
>>> turtle.speed()
9
Comment

python turtle

import turtle
tim = turtle.Pen()
t.shape('turtle')
t.pensize(5)
t.color('blue')
t.speed(1)
Comment

python turtle tutorial

>>> turtle.home()
>>> turtle.dot()
>>> turtle.fd(50); turtle.dot(20, "blue"); turtle.fd(50)
>>> turtle.position()
(100.00,-0.00)
>>> turtle.heading()
0.0
Comment

python turtle tutorial

>>> for i in range(4):
...     turtle.fd(50); turtle.lt(80)
...
>>> for i in range(8):
...     turtle.undo()
Comment

PREVIOUS NEXT
Code Example
Python :: python keyboardinterrupt 
Python :: python google chrome 
Python :: python get file path from in os.walk 
Python :: django m2m .add 
Python :: python subtract lists 
Python :: csv library python convert dict to csv 
Python :: change x axis frequency 
Python :: try open file 
Python :: install imgkit py 
Python :: Python function to calculate LCM of 2 numbers. 
Python :: write list to file python 
Python :: pandas fill nan methods 
Python :: how to ask a yes or no question on python 
Python :: python how to change back to the later directory 
Python :: python console width 
Python :: matlab to python 
Python :: compress tarfile python 
Python :: set seed train test split 
Python :: dynamic array python numpy 
Python :: python tkinter fenstergröße 
Python :: odoo scaffold 
Python :: only get top 10 python dataframe 
Python :: turn df to dict 
Python :: pymongo [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate 
Python :: render template in django 
Python :: python classes 
Python :: rotate point around point python 
Python :: django models integer field default value 
Python :: handle errors in flask 
Python :: hstack in numpy 
ADD CONTENT
Topic
Content
Source link
Name
2+7 =