如何使用Python创建直接可执行的跨平台GUI应用程序? [英] How can I create a directly-executable cross-platform GUI app using Python?
问题描述
问题是我不知道从哪里开始或如何编写一个GUI,任何人都可以点亮这个,并指出我的方向正确吗?
首先,您将需要一些使用Python绑定的GUI库,然后(如果需要)一些将您的python脚本转换为独立可执行文件的程序。
具有Python绑定(Windows,Linux,Mac)的跨平台GUI库
当然,许多,但我在野外看到的最受欢迎的是:
- Tkinter - 基于 Tk GUI工具包( pyt的事实上的标准GUI库Hon,商业项目免费)
- WxPython - 基于 WxWidgets (非常受欢迎,适用于商业项目)
- PyQt - 根据 Qt (也非常受欢迎,比WxWidgets更稳定,但商业项目的代价昂贵)
完整列表在 http://wiki.python.org/moin/GuiProgramming
单个可执行文件(Windows)
- py2exe - 可能是最受欢迎的( PyInstaller 也越来越受欢迎)
单个可执行文件(Linux)
- 冻结 - 以与py2exe相同的方式工作,但目标是Linux平台
单个可执行文件(Mac)
- py2app - 再次,像py2exe一样,但是定位到Mac OS
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.
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?
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.
Cross-platform GUI libraries with Python bindings (Windows, Linux, Mac)
Of course, there are many, but the most popular that I've seen in wild are:
- Tkinter - based on Tk GUI toolkit (de-facto standard GUI library for python, free for commercial projects)
- WxPython - based on WxWidgets (very popular, free for commercial projects)
- PyQt - based on Qt (also very popular and more stable than WxWidgets but costly license for commercial projects)
Complete list is at http://wiki.python.org/moin/GuiProgramming
Single executable (Windows)
- py2exe - Probably the most popular out there (PyInstaller is also gaining in popularity)
Single executable (Linux)
- Freeze - works the same way like py2exe but targets Linux platform
Single executable (Mac)
- py2app - again, works like py2exe but targets Mac OS
这篇关于如何使用Python创建直接可执行的跨平台GUI应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!