How To Draw Spiral Rainbow In Python Turtle

The turtle is built in library so we don’t need to install separately. We just need to import the library into our Python environment. The Python turtle library consists of all important methods and functions that we will need to create our designs and images. Import the turtle library using the following command.

How To Install Turtle:

pip install turtle


pip3 install turtle

turtle is a pre-installed Python library that enables users to create pictures and shapes by providing them with a virtual canvas. The onscreen pen that you use for drawing is called the turtle and this is what gives the library its name.

import turtle

t = turtle.Turtle()
s = turtle.Screen()

colors = ['red', 'purple', 'blue'
          , 'green', 'orange', 'yellow']



for x in range(200):
    t.pencolor(colors[x % len(colors)])
    t.width(x/100 + 1)


Leave a Reply

For News Subscribe Us!

Can curiosity may end shameless explained. True high on said mr on come. An do mr design at little myself wholly entire though. Attended of on stronger or mr pleasure.

You have been successfully Subscribed! Ops! Something went wrong, please try again.

© 2022 Code With AM