首页 > 解决方案 > 在 Python 中导入 WindowProporties 时出错

问题描述

我用这个命令安装了 Panda3D:

pip3 install panda3d==1.10.6

然后我制作了main .py:

from direct.showbase.ShowBase import ShowBase
from panda3d.core import WindowProporties

class Game(ShowBase):
    def __init__(self):
        ShowBase.__init__(self)     

        self.Proporties = WindowProporties
        self.Proporties.setSize(500, 500)
        self.win.requestProperties(properties)

if __name__ == "__main__": Game = Game()

当我运行此代码时,它会给出错误:

python3 __main__.py 

错误:

Traceback (most recent call last):
  File "__main__.py", line 2, in <module>
    from panda3d.core import WindowProporties
ImportError: cannot import name 'WindowProporties' from 'panda3d.core' (/home/kali/.local/lib/python3.8/site-packages/panda3d/core.cpython-38-x86_64-linux-gnu.so)

我在用:

提前感谢大家

标签: pythonimportpanda3d

解决方案


好像你的导入有错字,试试这个:

from panda3d.core import WindowProperties

推荐阅读