如何在Python中将两个应用程序(主循环)集成在一起
你好,我正在开发一个 VR 引擎“vizard”,它有(像任何其他游戏引擎一样)它的主循环,我想将它与一个有自己的主循环的多点触控框架“kivy”集成,可以这样做吗? 如果你能帮我找到关于这个主题的参考资料 提前谢谢你:D
hi i am working on a VR engine "vizard" it has (like any other game engine) its mainloop, i want to integrate it with a multi-touch framework "kivy" which has its own mainloop , is it possible to do so?
and if you can help me finding references about this topic
thank you in advance :D
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
另一件要做的事情是检查你想要使用的每个库,看看是否可以不使用它们的本机主循环 - 你必须自己构建一个主循环,它负责在每个库中调用“执行挂起事件”然后。由于您是自己编写主循环,因此这是要走的路。
如果没有记录的方法来执行此操作,您应该检查其他库的源代码并在您的库中重新实现其主循环 - 即使只是为了概念验证的目的。并在“kivy”项目上打开一个功能请求,以便能够在没有主循环的情况下使用它。
啊,检查 kivy 上的文档,我发现你可以轻松继承他们的 eventloopbase 并将其合并到你自己的主循环中:
http://kivy.org/docs/api-kivy.base.html - 你的幸运日。
The other thing to do is check each library you want to use, and see if it is possible to go without using their native mainloop - you will have to build a mainloop yourself which takes care of calling an "execute pending events" in each of then. Since you are writting your mainloop yourself, this is the way to go.
IF there is no documented way to do it, you should check the source of the other library and re-implement its mainloop inside yours - even if only for proof-of-concept purposes. And open a feaure request on the "kivy" project for being able to use it without a mainloop.
Ah, checking the docs on kivy, I see you can easily inherit their eventloopbase and incorporate it in your own mainloop:
http://kivy.org/docs/api-kivy.base.html - your lucky day.
这在技术上是可行的,但你不应该这样做。
只需打开源代码,获取两个主循环的代码并将其拼接在一起即可。
但结果可能会被打破。
It is technically possible, but you should not do it.
Simply open up the source, get the code for the two main loops and stitch it together.
The results will probably be broken, though.