Attachment 'checkboard.py'

Download

   1 #!/usr/bin/env python
   2 # coding: utf
   3 '''
   4 '''
   5 
   6 from turtle import *
   7 
   8 def square(x,y,l,tofill=False):
   9     up()
  10     goto(x,y)
  11     fill(tofill)
  12     down()
  13     for i in xrange(4):
  14         forward(l)
  15         left(90)
  16     fill(False)
  17 
  18 N=8
  19 reset()
  20 w,h=screensize()
  21 w=h=min(w,h)
  22 screensize(w,h)
  23 speed("fastest")
  24 for x in xrange(N):
  25     for y in xrange(N):
  26         square(-w+w*2*x/N,-h+h*y*2/N,w*2/N,(x+y)%2)
  27 
  28 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.