使用Python创建可直接执行的跨平台GUI应用 [英] Create a directly-executable cross-platform GUI app using Python
问题描述
Python可在多种平台上运行,并且可用于桌面和Web应用程序,因此,我得出结论,有一种方法可以将其编译为Mac,Windows和Linux的可执行文件。
Python works on multiple platforms and can be used for desktop and web applications, thus I conclude that there is some way to compile it into an executable for Mac, Windows and Linux.
问题是我不知道从哪里开始或如何用它编写GUI,任何人都可以对此有所了解,并指出正确的方向吗?
The problem being I have no idea where to start or how to write a GUI with it, can anybody shed some light on this and point me in the right direction please?
推荐答案
首先,您将需要一些带有Python绑定的GUI库,然后(如果需要)一些程序,它将Python脚本转换为独立的可执行文件。
First you will need some GUI library with Python bindings and then (if you want) some program that will convert your python scripts into standalone executables.
带有Python绑定的跨平台GUI库(Windows,Linux,Mac)
当然,许多,但我在野外看到的最受欢迎的是:
Of course, there are many, but the most popular that I've seen in wild are:
- Tkinter -基于 Tk GUI工具包(适用于python的事实上的标准GUI库,免费
- WxPython -基于 WxWidgets (流行,对商业项目免费)
- Qt 使用 PyQt绑定或 Qt for Python 。前者并非免费用于商业项目。后者还不成熟,但是可以免费使用。
- Tkinter - based on Tk GUI toolkit (de-facto standard GUI library for python, free for commercial projects)
- WxPython - based on WxWidgets (popular, free for commercial projects)
- Qt using the PyQt bindings or Qt for Python. The former is not free for commercial projects. The latter is less mature, but can be used for free.
完整列表位于 http://wiki.python.org/moin/GuiProgramming
单个可执行文件(所有平台)
- PyInstaller -最活跃(也可以与
PyQt
一起使用) - fbs -如果您在上方选择了Qt
- PyInstaller - the most active(Could also be used with
PyQt
) - fbs - if you chose Qt above
单个可执行文件(Windows)
- py2exe -曾经是最受欢迎的
- py2exe - used to be the most popular
单个可执行文件(Linux )
- 冻结-与py2exe一样工作,但以Linux平台为目标
- Freeze - works the same way like py2exe but targets Linux platform
单个可执行文件(Mac)
- py2app -同样,其工作方式类似于py2exe,但定位到Mac OS
- py2app - again, works like py2exe but targets Mac OS
这篇关于使用Python创建可直接执行的跨平台GUI应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!