因此,我试图在屏幕上绘制一些文本,并且每当我按一下Turtle图形屏幕时,它都将变得无响应。当我尝试通过添加主循环来修复它时,它不会继续使用其余的代码。我看到应该添加的地方
done()
在块的末尾,但 python 说它不存在,我试着把turtle.done() 但什么都没有。
这是代码:
def draw_robot(choice_robot,robots):
stats = robots[choice_robot]
style = 'Arial',14,'bold'
t.setheading(-90)
t.write('Name: '+choice_robot,font=style,align = 'center')
t.forward(25)
t.write('Battery: '+stats[0],font=style,align = 'center')
t.forward(25)
t.write('Intelligence: '+stats[1],font=style,align = 'center')
turtle.mainloop()
我怎样才能解决这个问题?
慕盖茨4494581
相关分类