Attachment 'rainbow.py'

Download

   1 #!/usr/bin/env python
   2 # coding: utf
   3 '''
   4 '''
   5 
   6 from turtle import *
   7 
   8 reset()
   9 w,h=screensize()
  10 w=h=min(w,h)
  11 screensize(w,h)
  12 
  13 speed("fastest")
  14 
  15 def pie(r):
  16     forward(r)
  17     down()
  18     fill(True)
  19     left(90)
  20     circle(r,180)
  21     left(90)
  22     fill(False)
  23     up()
  24     forward(r)
  25 
  26 colors="red","orange","yellow","green","cyan","blue","purple"
  27 for i,c in enumerate(colors+("white",)):
  28     color(c)
  29     pie(w-w*i/10)
  30 
  31 exitonclick()

Attached Files

To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.

You are not allowed to attach a file to this page.