12 Frame.__init__(self, master)
23 canheight = self.
r * self.
space 24 self.
can = Canvas(self, bg=
"white",
25 width=canwidth, height=canheight)
40 for i
in xrange(self.
num):
41 self.x.append(self.
r * self.
space / 2 * (i+0.5) * 2)
42 self.y.append(self.
r * self.
space / 2)
43 self.x1.append(self.
x[i] - self.
r)
44 self.y1.append(self.
y[i] - self.
r)
45 self.x2.append(self.
x[i] + self.
r)
46 self.y2.append(self.
y[i] + self.
r)
47 self.sx1.append(self.
x[i] - self.
r * 0.1)
48 self.sy1.append(self.
y[i] - self.
r * 0.1)
49 self.sx2.append(self.
x[i] + self.
r * 0.1)
50 self.sy2.append(self.
y[i] + self.
r * 0.1)
51 self.circ.append(self.can.create_oval(self.
x1[i], self.
y1[i],
52 self.
x2[i], self.
y2[i],
55 self.circ.append(self.can.create_oval(self.
sx1[i], self.
sy1[i],
59 self.line.append(self.can.create_line(self.
x[i], self.
y[i],
62 fill=
"#700040", width=5))
66 if len(angle) != self.
num:
return 70 self.can.delete(self.
line[i])
71 self.
line[i] = self.can.create_line(self.
x[i], self.
y[i],
72 self.
x[i] + self.
r * math.cos(a),
73 self.
y[i] + self.
r * math.sin(a),
74 fill=
"#700040", width=5)
82 thread.start_new_thread(m.mainloop, ())
83 thread.start_new_thread(n.mainloop, ())
86 angle = [cnt % 360, - cnt % 360, cnt % 360, - cnt % 360, cnt % 360, - cnt % 360]
92 if __name__ ==
'__main__':
test()
def __init__(self, num, radius, master=None)
def set_angle(self, angle)