@PaddyMcCarthy/

DeafeningDroopyBusiness

Python (with Turtle)

No description

fork
loading

This Plugin Crashed!

Error: Error: must not create an existing file {"type":"CREATE_FILE","wid":"0.6641228147664147","path":"main.py","file":{"path":"main.py","content":{"asEncoding":{"base64":"aW1wb3J0IHR1cnRsZQojZnJvbSBpdGVydG9vbHMgaW1wb3J0IGN5Y2xlCmZyb20gdGltZSBpbXBvcnQgc2xlZXAKCmRlZiByZWN0KHQsIHgsIHkpOgogICAgeDIsIHkyID0geC8yLCB5LzIKICAgIHQuc2V0cG9zKC14MiwgLXkyKQogICAgdC5wZW5kb3duKCkKICAgIGZvciBwb3MgaW4gWygteDIsIHkyKSwgKHgyLCB5MiksICh4MiwgLXkyKSwgKC14MiwgLXkyKV06IAogICAgICAgIHQuZ290byhwb3MpCiAgICB0LnBlbnVwKCkKCmRlZiByZWN0cyh0LCBjb2xvdXIsIHdhaXRfYmV0d2Vlbl9yZWN0PTAuMSk6CiAgICBmb3IgeCBpbiByYW5nZSg1NTAsIDAsIC0yNSk6CiAgICAgICAgdC5jb2xvcihjb2xvdXIpCiAgICAgICAgcmVjdCh0LCB4LCB4Ki43NSkKICAgICAgICBzbGVlcCh3YWl0X2JldHdlZW5fcmVjdCkKCnRsPXR1cnRsZS5UdXJ0bGUoKQpzY3JlZW49dHVydGxlLlNjcmVlbigpCnNjcmVlbi5zZXR1cCg2MjAsNjIwKQpzY3JlZW4uYmdjb2xvcignYmxhY2snKQojc2NyZWVuLnRpdGxlKCdSb3NldHRhIENvZGUgVmlicmF0aW5nIFJlY3RhbmdsZXMnKQp0bC5wZW5zaXplKDMpCnRsLnNwZWVkKDApCnRsLnBlbnVwKCkKdGwuaHQoKSAKY29sb3VycyA9ICdyZWQgZ3JlZW4gYmx1ZSBvcmFuZ2Ugd2hpdGUgeWVsbG93Jy5zcGxpdCgpCmZvciBjb2xvdXIgaW4gY29sb3VyczoKICAgIHJlY3RzKHRsLCBjb2xvdXIpCiAgICBzbGVlcCgwLjUpCnRsLmh0KCkgCg=="},"asBuffer":null},"loaded":true}}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import turtle
#from itertools import cycle
from time import sleep

def rect(t, x, y):
    x2, y2 = x/2, y/2
    t.setpos(-x2, -y2)
    t.pendown()
    for pos in [(-x2, y2), (x2, y2), (x2, -y2), (-x2, -y2)]: 
        t.goto(pos)
    t.penup()

def rects(t, colour, wait_between_rect=0.1):
    for x in range(550, 0, -25):
        t.color(colour)
        rect(t, x, x*.75)
        sleep(wait_between_rect)

tl=turtle.Turtle()
screen=turtle.Screen()
screen.setup(620,620)
screen.bgcolor('black')
#screen.title('Rosetta Code Vibrating Rectangles')
tl.pensize(3)
tl.speed(0)
tl.penup()
tl.ht() 
colours = 'red green blue orange white yellow'.split()
for colour in colours:
    rects(tl, colour)
    sleep(0.5)
tl.ht() 
result
console