私はcocos2d
Pythonを使って学び始めたばかりです。
これを pycharm に書くと:
import cocos
class HelloWorld(cocos.layer.Layer):
def __init__(self):
super(HelloWorld, self).__init__()
label = cocos.text.Label('Hello, World!',
font_name = 'Times New Roman',
font_size = 32,
anchor_x='center', anchor_y='center')
label.position = 320, 240
self.add(label)
cocos.director.director.init()
hello_layer = HelloWorld()
main_scene = cocos.scene.Scene(hello_layer)
cocos.director.director.run(main_scene)
Pycharm はエラーを表示しますcannot find reference 'layer' in '__init__.py'
が、実行するとコードは機能します。コードはpycharm内から(端末経由ではなく)実行しても機能しますが、驚くことではありませんが、言及する必要があるかもしれません. また、関連する自動提案やオートコンプリートも提供しませんcocos2d
。
これを修正する方法について何か考えはありますか?
私はpython 3.4を使用しています。