summaryrefslogtreecommitdiffstats
path: root/Demo/turtle/tdemo_I_dontlike_tiltdemo.py
blob: adec52b06fb90ab64d0284b7110ebfdd3cef3e42 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/usr/bin/python
"""       turtle-example-suite:

     tdemo-I_dont_like_tiltdemo.py

Demostrates
  (a) use of a tilted ellipse as
      turtle shape
  (b) stamping that shape

We can remove it, if you don't like it.
      Without using reset() ;-)
 ---------------------------------------
"""
from turtle import *
import time

def main():
    reset()
    shape("circle")
    resizemode("user")

    pu(); bk(24*18/6.283); rt(90); pd()
    tilt(45)

    pu()

    turtlesize(16,10,5)
    color("red", "violet")
    for i in range(18):
        fd(24)
        lt(20)
        stamp()
    color("red", "")
    for i in range(18):
        fd(24)
        lt(20)
        stamp()

    tilt(-15)
    turtlesize(3, 1, 4)
    color("blue", "yellow")
    for i in range(17):
        fd(24)
        lt(20)
        if i%2 == 0:
            stamp()
    time.sleep(1)
    while undobufferentries():
        undo()
    ht()
    write("OK, OVER!", align="center", font=("Courier", 18, "bold"))
    return "Done!"

if __name__=="__main__":
    msg = main()
    print msg
    mainloop()