We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b85dc4f commit 4249d28Copy full SHA for 4249d28
Polyline
@@ -0,0 +1,28 @@
1
+# Polyline drawing in codeskulptor
2
+
3
+import simplegui
4
+import math
5
6
+polyline = []
7
8
+def click(pos):
9
+ global polyline
10
+ polyline.append(pos)
11
12
+def clear():
13
14
+ polyline = []
15
16
+def draw(canvas):
17
+ if len(polyline) == 1:
18
+ canvas.draw_point(polyline[0] , "White")
19
+ for i in range(1 ,len(polyline)):
20
+ canvas.draw_line(polyline[i-1] ,polyline[i] ,2 ,"White" )
21
22
+frame = simplegui.create_frame("Echo click", 300, 200)
23
+frame.set_mouseclick_handler(click)
24
+frame.set_draw_handler(draw)
25
+frame.add_button("Clear", clear)
26
27
+frame.start()
28
0 commit comments