使用Python创建可直接执行的跨平台GUI应用 [英] Create a directly-executable cross-platform GUI app using Python

查看:468
本文介绍了使用Python创建可直接执行的跨平台GUI应用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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 - 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 - 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆