我试着跟随kivy的教程PongBall
,但VScode给了我行中的错误
from kivy.properties import NumericProperty, ReferenceListProperty
带信息:
[pylint] E0611:No name 'NumericProperty' in module 'kivy.properties'
[pylint] E0611:No name 'ReferenceListProperty' in module 'kivy.properties'
这个模块是我相信cython模块,当我打开文件properties.pxd
我可以找到以下代码:
附录: 到目前为止,我的整个代码:
import kivy
kivy.require('1.10.0')
from kivy.app import App
from kivy.uix.widget import Widget
from kivy.uix.button import Button
from kivy.uix.boxlayout import BoxLayout
from kivy.properties import NumericProperty, ReferenceListProperty
from kivy.vector import Vector
class PongGame(Widget):
pass
class PongBall(Widget):
# velocity of the ball on x and y axis
velocity_x = NumericProperty(0)
velocity_y = NumericProperty(0)
velocity = ReferenceListProperty(velocity_x, velocity_y)
def move(self):
self.pos = Vector(*self.velocity) + self.pos
class PongApp(App):
def build(self):
return PongGame()
if __name__ == '__main__':
PongApp().run()
问题: 为什么它不想导入?我能做些什么来修复它?在
目前没有回答
相关问题 更多 >
编程相关推荐