【问题标题】:Running Panda3D in separate thread在单独的线程中运行 Panda3D
【发布时间】:2019-08-12 13:45:15
【问题描述】:

不幸的是,我是 Python 和 Panda3D 的初学者。到目前为止,我所做的是尝试 Panda3D 功能并构建一些示例世界,代码结尾如下:

base = ShowBase()
world = World()
base.run()

是否可以在另一个线程中启动 Panda3D,同时让主线程计算 Panda3D 世界中对象的运动数据?所以程序的主要任务是计算,另外 Panda3D 世界应该以图形方式显示进度。

我试图让单独的线程执行上面的代码,但是我的主线程计算(分段错误)和 Panda3D 窗口(黑色窗口,无响应)都崩溃了。

class myThread (threading.Thread):
    def __init__(self):
        threading.Thread.__init__(self)

    def run(self):
        base = ShowBase()
        world = World()
        base.run()

t1 = myThread()
t1.start()

如何让它们同时运行,从而使两个线程之间的通信成为可能?

【问题讨论】:

    标签: python multithreading panda3d


    【解决方案1】:

    你使用的是direct.stdpy而不是python线程包吗?

    https://docs.panda3d.org/1.10/python/programming/threading

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-09-26
      • 2012-05-20
      • 2015-01-24
      • 2011-04-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多