刚开始kivy框架,在kivy painting app tutorial中有以下代码行:
touch.ud['line'] = Line(points=(touch.x, touch.y))
有人能解释一下touch.ud
的确切含义吗?
使用print(help(touch.ud))
返回
Help on EnhancedDictionary in module kivy.input.motionevent object:
class EnhancedDictionary(builtins.dict) ...
把所有这些放在一起,仍然不知道发生了什么。有人能特别解释一下“ud
”部分吗。谢谢!在
让我们看一下touch parts是提供事件} ,因此,如果你想找到信息,你应该转到文档的那一部分,检查^{} ,你会得到以下结果:
on_touch_XXX
的参数,它是^{然后,描述告诉我们,如果您想共享一些您想在_touch_xxx上的其他事件中使用的信息,则将其保存在该字典中是正确的:
在特定的例子中,在
on_touch_down
中创建的行的实例被保存,因为on_touch_move
需要它来添加更多的点。在相关问题 更多 >
编程相关推荐