annotate docs/pycon2010/schematic.py @ 351:8a5bc9f5c28e

cmd2 docs
author catherine@Drou
date Tue, 16 Feb 2010 23:07:04 -0500
parents
children
rev   line source
351
8a5bc9f5c28e cmd2 docs
catherine@Drou
parents:
diff changeset
1 from turtle import *
8a5bc9f5c28e cmd2 docs
catherine@Drou
parents:
diff changeset
2 hideturtle()
8a5bc9f5c28e cmd2 docs
catherine@Drou
parents:
diff changeset
3 width(6)
8a5bc9f5c28e cmd2 docs
catherine@Drou
parents:
diff changeset
4 pensize = 10
8a5bc9f5c28e cmd2 docs
catherine@Drou
parents:
diff changeset
5 pu()
8a5bc9f5c28e cmd2 docs
catherine@Drou
parents:
diff changeset
6 goto(0,-400)
8a5bc9f5c28e cmd2 docs
catherine@Drou
parents:
diff changeset
7
8a5bc9f5c28e cmd2 docs
catherine@Drou
parents:
diff changeset
8 def rectangle(x, y, _label):
8a5bc9f5c28e cmd2 docs
catherine@Drou
parents:
diff changeset
9 pu()
8a5bc9f5c28e cmd2 docs
catherine@Drou
parents:
diff changeset
10 seth(0)
8a5bc9f5c28e cmd2 docs
catherine@Drou
parents:
diff changeset
11 backward(x / 2)
8a5bc9f5c28e cmd2 docs
catherine@Drou
parents:
diff changeset
12 fontsize = 40
8a5bc9f5c28e cmd2 docs
catherine@Drou
parents:
diff changeset
13 pd()
8a5bc9f5c28e cmd2 docs
catherine@Drou
parents:
diff changeset
14 for i in range(2):
8a5bc9f5c28e cmd2 docs
catherine@Drou
parents:
diff changeset
15 forward(x)
8a5bc9f5c28e cmd2 docs
catherine@Drou
parents:
diff changeset
16 left(90)
8a5bc9f5c28e cmd2 docs
catherine@Drou
parents:
diff changeset
17 forward(y)
8a5bc9f5c28e cmd2 docs
catherine@Drou
parents:
diff changeset
18 left(90)
8a5bc9f5c28e cmd2 docs
catherine@Drou
parents:
diff changeset
19 pu()
8a5bc9f5c28e cmd2 docs
catherine@Drou
parents:
diff changeset
20 forward(x / 2)
8a5bc9f5c28e cmd2 docs
catherine@Drou
parents:
diff changeset
21 left(90)
8a5bc9f5c28e cmd2 docs
catherine@Drou
parents:
diff changeset
22 forward(y / 2 - fontsize)
8a5bc9f5c28e cmd2 docs
catherine@Drou
parents:
diff changeset
23 pd()
8a5bc9f5c28e cmd2 docs
catherine@Drou
parents:
diff changeset
24 write(_label, align='center', font=('Arial', fontsize, 'bold'))
8a5bc9f5c28e cmd2 docs
catherine@Drou
parents:
diff changeset
25
8a5bc9f5c28e cmd2 docs
catherine@Drou
parents:
diff changeset
26 rectangle(800, 80, 'cmd')
8a5bc9f5c28e cmd2 docs
catherine@Drou
parents:
diff changeset
27 pu()
8a5bc9f5c28e cmd2 docs
catherine@Drou
parents:
diff changeset
28 forward(80)
8a5bc9f5c28e cmd2 docs
catherine@Drou
parents:
diff changeset
29 rectangle(200, 400, 'cmd2')
8a5bc9f5c28e cmd2 docs
catherine@Drou
parents:
diff changeset
30
8a5bc9f5c28e cmd2 docs
catherine@Drou
parents:
diff changeset
31 while True:
8a5bc9f5c28e cmd2 docs
catherine@Drou
parents:
diff changeset
32 pass