ยปCore Development>Code coverage>Lib/turtledemo/two_canvases.py

Python code coverage for Lib/turtledemo/two_canvases.py

#countcontent
1n/a"""turtledemo.two_canvases
2n/a
3n/aUse TurtleScreen and RawTurtle to draw on two
4n/adistinct canvases in a separate windows. The
5n/anew window must be separately closed in
6n/aaddition to pressing the STOP button.
7n/a"""
8n/a
9n/afrom turtle import TurtleScreen, RawTurtle, TK
10n/a
11n/adef main():
12n/a root = TK.Tk()
13n/a cv1 = TK.Canvas(root, width=300, height=200, bg="#ddffff")
14n/a cv2 = TK.Canvas(root, width=300, height=200, bg="#ffeeee")
15n/a cv1.pack()
16n/a cv2.pack()
17n/a
18n/a s1 = TurtleScreen(cv1)
19n/a s1.bgcolor(0.85, 0.85, 1)
20n/a s2 = TurtleScreen(cv2)
21n/a s2.bgcolor(1, 0.85, 0.85)
22n/a
23n/a p = RawTurtle(s1)
24n/a q = RawTurtle(s2)
25n/a
26n/a p.color("red", (1, 0.85, 0.85))
27n/a p.width(3)
28n/a q.color("blue", (0.85, 0.85, 1))
29n/a q.width(3)
30n/a
31n/a for t in p,q:
32n/a t.shape("turtle")
33n/a t.lt(36)
34n/a
35n/a q.lt(180)
36n/a
37n/a for t in p, q:
38n/a t.begin_fill()
39n/a for i in range(5):
40n/a for t in p, q:
41n/a t.fd(50)
42n/a t.lt(72)
43n/a for t in p,q:
44n/a t.end_fill()
45n/a t.lt(54)
46n/a t.pu()
47n/a t.bk(50)
48n/a
49n/a return "EVENTLOOP"
50n/a
51n/a
52n/aif __name__ == '__main__':
53n/a main()
54n/a TK.mainloop() # keep window open until user closes it