Tags

, , , ,

You can do some funny staff with Python. it simply amuses.
Issue this command in your Linux terminal:
sudo apt-get install python3-tk
It will install the necessary packages. Now it is time to write some code:


#!/usr/bin/python3

import turtle

pen = turtle.Pen()
pen.speed(0)
turtle.bgcolor("black")
colors =['red', 'orange', 'yellow', 'blue', 'pink', 'white', 'purple', 'green', 'light blue']
sides = 8

for x in range(360):
    pen.pencolor(colors[x % sides])
    pen.forward(x * sides / 3 + x)
    pen.left(360 / sides + 1)
    pen.width(x * sides / 100)

If you run this program, you will see something like this:

Python with turtle module

Python with turtle module

Advertisements