【发布时间】:2016-01-05 14:16:53
【问题描述】:
我正在尝试将文件解析为列表,然后使用海龟图形绘制列表中的形状。我设法解析文件并将其作为列表成功返回,但是,当我尝试使用海龟图形在文件中绘制形状时出现错误。代码如下:
list_of_shapes = parser.parse(local_file_name) # this will parse the file into a list
drawer = Turtle_Draw_Shape_Controller()
drawer.draw_shapes(list_of_shapes)
一旦我尝试使用海龟图形来绘制图片,我就会收到以下错误:
Traceback (most recent call last):
File "/Volumes/shapes.py, line 206, in <module>
drawer.draw_shapes(list_of_shapes)
File "/Volumes/shapes.py", line 184, in draw_shapes
shape_type = shape.get_shape_type()
AttributeError: 'tuple' object has no attribute 'get_shape_type'
【问题讨论】:
标签: python list turtle-graphics