''' Make a sprial pattern by looping (can run in Windows console mode) ''' # @micro1 # uname -a # Linux micro1 3.19.8-100.fc20.x86_64 #1 SMP Tue May 12 17:08:50 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux # setenv DISPLAY :0.0 # import graphical capability from turtle import * winsize = 500 stepsize = 4 speed = 10 # make a rectangular window of winsize x winsize pixels setup(winsize,winsize) # make a turtle to build the graphics tl = Turtle() # hide the turtle (cursor) tl.hideturtle() tl.speed(speed) # make a faster speed than default tl.color('green', 'blue') # color('blue', 'yellow') # hideturtle() def jumpto(x=0,y=0): tl.penup() tl.goto(x,y) tl.pendown() ''' for i in range(4): # draw a box tl.forward(10) tl.left(90) ''' # goto(winsize//2,winsize//2) jumpto(0,0) for i in range(winsize//stepsize-10): # limit the turtle to increment within the window tl.forward(i*stepsize) # forward i*4 steps (increasingly) in each loop tl.right(90) # right spiral # tl.forward(i*stepsize) # tl.forward(i+stepsize) # different line size # tl.left(90) # left spiral tl.color('orange') # tl.goto(winsize//2,winsize//2) jumpto(10,10) for i in range(winsize//stepsize-10): # limit the turtle to increment within the 500x500 window tl.forward(i*stepsize) # forward i*4 steps (increasingly) in each loop # tl.right(90) # right spiral tl.left(90) # left spiral tl.color('red') jumpto(-10,-10) for i in range(winsize//stepsize-10): # limit the turtle to increment within the 500x500 window tl.forward(i*stepsize) # forward i*4 steps (increasingly) in each loop # tl.right(90) # right spiral tl.left(80) # left spiral # tl.left(60) # tl.left(45) # tl.left(30) tl.color('magenta') jumpto(-10,10) for i in range(winsize//stepsize-10): # limit the turtle to increment within the 500x500 window tl.forward(i*stepsize) # forward i*4 steps (increasingly) in each loop # tl.forward(60) # tl.right(90) # right spiral tl.left(160) # left spiral # FIN