Last active
September 24, 2016 22:23
-
-
Save edib/7dc60f2a0692ecefc79e70bcf1eabc59 to your computer and use it in GitHub Desktop.
rotate number given as command line argument
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import turtle | |
import random | |
import sys | |
def r(): | |
return random.randint(0, 255) | |
screen = turtle.Screen() | |
screen.bgcolor("#fff") | |
screen.colormode(255) | |
tosba = turtle.Turtle() | |
tosba.color("#f00") | |
tosba.pensize(5) | |
tosba.speed(0) | |
tosba.hideturtle() | |
loop = int(sys.argv[1]) | |
for i in range(loop): | |
tosba.color(r(),r(),r()) | |
for i in range(4): | |
tosba.rt(90) | |
tosba.fd(100) | |
tosba.rt(360/loop) | |
tosba.hideturtle() | |
turtle.getscreen()._root.mainloop() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment