fork download
  1. # -*- coding: utf-8 -*-
  2. '''without set[x|y|heading], goto, if, ...'''
  3.  
  4. import turtle
  5.  
  6. def draw5(t, l, c, w):
  7. t.color(c); t.width(w)
  8. t.forward(l); t.right(36)
  9. t.backward(l); t.right(36)
  10. t.forward(l); t.right(36)
  11. t.backward(l); t.right(36)
  12. t.forward(l); t.right(36)
  13. t.left(180)
  14.  
  15. def main(t, f):
  16. t.setup(width=1024, height=768)
  17. t.tracer(f); t.delay(1)
  18. t.up(); t.left(90); t.forward(300); t.left(90); t.forward(300); t.left(90)
  19. c = ((.8, .8, .8),
  20. ( 1, 0, 0), ( 0, 1, 0), ( 1, 1, 0),
  21. (.9, .9, .9), (.9, 0, 0), (.5, 1, 0),
  22. (.8, 0, 0), ( 0, .5, 0), (.8, .5, 0))
  23. for s in xrange(12): # 0, 1, 2, 3, 4, 5, 6(4), 7(3), 8(2), 9(1), 10(0), 11(1)
  24. t.tracer(f); t.delay(1)
  25. t.forward((s % 3) * 200);
  26. t.left(90); t.forward((s / 3) * 200); t.right(90)
  27. t.right(36 / 2)
  28. t.down()
  29. for i in xrange(10):
  30. t.tracer(i < 5); t.delay(1)
  31. w = (10 - 1 - i) * 2 + 1
  32. draw5(t, 100, c[i], w)
  33. t.left(36 * s)
  34. t.up()
  35. t.right(36 * 10 * s); t.left(36 / 2)
  36. t.left(90); t.backward((s / 3) * 200); t.right(90)
  37. t.backward((s % 3) * 200);
  38. t.color((1,0,1)); t.width(0)
  39. t.tracer(f); t.delay(20)
  40. t.up(); t.forward(600); t.left(90); t.down(); t.forward(600)
  41.  
  42. if __name__ == '__main__':
  43. main(turtle, True)
Runtime error #stdin #stdout #stderr 0.07s 26544KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
Traceback (most recent call last):
  File "prog.py", line 43, in <module>
  File "prog.py", line 16, in main
  File "<string>", line 6, in setup
  File "/usr/lib/python2.7/lib-tk/turtle.py", line 3552, in Screen
    Turtle._screen = _Screen()
  File "/usr/lib/python2.7/lib-tk/turtle.py", line 3568, in __init__
    _Screen._root = self._root = _Root()
  File "/usr/lib/python2.7/lib-tk/turtle.py", line 458, in __init__
    TK.Tk.__init__(self)
  File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1817, in __init__
    self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
_tkinter.TclError: Can't find a usable init.tcl in the following directories: 
    /usr/share/tcltk/tcl8.6 /usr/lib/tcl8.6 /lib/tcl8.6 /usr/library /library /tcl8.6.4/library /tcl8.6.4/library



This probably means that Tcl wasn't installed properly.