如何使用Python创建直接可执行的跨平台GUI应用程序? [英] How can I create a directly-executable cross-platform GUI app using Python?

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

问题描述

Python可以在多个平台上工作,可以用于桌面和Web应用程序,所以我得出结论,有一些方法将它编译成可执行的Mac,Windows和Linux。



问题是我不知道从哪里开始或如何编写一个GUI,任何人都可以点亮这个,并指出我的方向正确吗?

解决方案

首先,您将需要一些使用Python绑定的GUI库,然后(如果需要)一些将您的python脚本转换为独立可执行文件的程序。



具有Python绑定(Windows,Linux,Mac)的跨平台GUI库



当然,许多,但我在野外看到的最受欢迎的是:





完整列表在 http://wiki.python.org/moin/GuiProgramming



单个可执行文件(Windows)





单个可执行文件(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屋!

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