Jython 是否能够制作 QT 应用程序(并且从 Python 进行的转换是否值得)?
我用 PyQt4 和 Python 构建了一个相当复杂的应用程序,但发送给人们是一件痛苦的事情(一旦我这样做了,他们不知道如何运行它)。然后还有一些依赖关系需要解决。啊。
无论如何,我刚刚了解了 Jython,并且由于几乎每个人都安装了 Java,因此它似乎是解决我的 Python 脚本分发问题的完美解决方案。是否有人真正使用 Jython 开发了一款功能性软件,并且如果存在的话,是否带有 Jambi 绑定?
我只是问一下,这样我就不会去挖掘一些不起作用的东西。
谢谢!
I've built a fairly complicated application with PyQt4 and Python, but it is a pain to send to people (and once I do, they have no idea how to run it). Then there are dependencies to wrestle. Ugh.
Anyways, I just learned about Jython, and since virtually everybody has Java installed, it seems like a perfect solution to my problem of distribution of Python scripts. Has anybody actually developed a functional piece of software with Jython, and if it even exists, one with Jambi bindings?
I'm just asking so that I don't go digging for something which doesn't work.
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您确实将此应用程序移至 Jython,则必须将 GUI 从 QT 转换为 Jambi。
Jython 是用 Java 实现的 Python 语言,运行在 Java 虚拟机上。由于 Jython 应用程序在 JVM 上运行,因此它可以使用任何 Java 库,例如 SWING 或 Jambi。
PyQT 和 Jambi 之间的差异可能非常小,但从根本上来说,您不会直接使用 QT。相反,您将使用占碑。如果您使用任何非标准 Python 模块,您仍然需要解决打包问题。
如果您的应用程序使用其他用 C 实现的 Python 模块,那么您还需要将它们替换为 Java 库。 Jython 非常擅长在不更改的情况下运行大量纯 Python 代码,但 Jython 运行在 Java 环境中,并且某些基本对象(例如字符串)的实现方式存在差异。 Jython 使用 Java 内部结构、Java 的垃圾收集器等。
通过这个SO问题可以获得更多信息: Migration from CPython to Jython
If you did move this application to Jython, you would have to convert the GUI from QT to Jambi.
Jython is the Python language implemented in Java to run on the Java virtual machine. Because it runs on the JVM, Jython apps can use any Java libraries, such as SWING or Jambi.
It is possible that the differences between PyQT and Jambi are very small, but fundamentally, you would not be using QT directly. Instead you would be using Jambi. And if you use any non-standard Python modules you will still have to resolve packaging issues.
If your application uses other Python modules which are implemented in C, then you would also need to replace those with Java libraries. Jython is great at running a lot of pure Python code unchanged, but Jython runs in a Java environment and there are differences in the way some fundamental objects, such as strings, are implemented. Jython uses Java internals, Java's garbage collector, and so on.
There is more info available via this SO question: Migrating from CPython to Jython