我正在制作一个使用codeskulptor创建图形的python程序,我想出了这个错误,我不知道它有什么问题,我该如何解决? 代码:
pointx = 0
pointy = 0
prepointx = 0
prepointy = 0
positionx = []
positiony = []
def draw_handler(canvas):
global pointx, pointy
for v in range(len(values)):
if v != 0:
prepointx = pointx
prepointy = pointy
pointx = v * 6
pointy = values[v] - 45 * 2
canvas.draw_point((pointx, pointy), 'red')
if v != 0: //Syntax error:bad token ''
canvas.draw_line((prepointx, prepointy), (pointx, pointy), 3, 'red')
frame = simplegui.create_frame('Data', 425, 300)
frame.set_draw_handler(draw_handler)
frame.start
答案 0 :(得分:0)
Your code is wronged indented.
Also values
is not defined.
But the real problem is probably frame.start
. To call the start method you must do frame.start()
.
I made the corrections, see: http://www.codeskulptor.org/#user40_zJYfuypQ0CWRHRA.py