Create a directly-executable cross-platform GUI app using Python

前端 未结 12 2166
予麋鹿
予麋鹿 2020-11-22 10:52

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

相关标签:
12条回答
  • 2020-11-22 11:31

    !!! KIVY !!!

    I was amazed seeing that no one mentioned Kivy!!!

    I have once done a project using Tkinter, although they do advocate that it has improved a lot, it still gives me a feel of windows 98, so I switched to Kivy.

    I have been following a tutorial series if it helps...

    Just to give an idea of how kivy looks, see this (The project I am working on):

    And I have been working on it for barely a week now ! The benefits for Kivy you ask? Check this

    The reason why I chose this is, its look and that it can be used in mobile as well.

    0 讨论(0)
  • 2020-11-22 11:35

    An alternative tool to py2exe is bbfreeze which generates executables for windows and linux. It's newer than py2exe and handles eggs quite well. I've found it magically works better without configuration for a wide variety of applications.

    0 讨论(0)
  • 2020-11-22 11:37

    Since python is installed on nearly every non-Windows OS by default now, the only thing you really need to make sure of is that all of the non-standard libraries you use are installed.

    Having said that, it is possible to build executables that include the python interpreter, and any libraries you use. This is likely to create a large executable, however.

    MacOS X even includes support in the Xcode IDE for creating full standalone GUI apps. These can be run by any user running OS X.

    0 讨论(0)
  • 2020-11-22 11:39

    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 (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.

    Complete list is at http://wiki.python.org/moin/GuiProgramming

    Single executable (all platforms)

    • PyInstaller - the most active(Could also be used with PyQt)
    • fbs - if you chose Qt above

    Single executable (Windows)

    • py2exe - used to be the most popular

    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
    0 讨论(0)
  • 2020-11-22 11:39

    Another system (not mentioned in the accepted answer yet) is PyInstaller, which worked for a PyQt project of mine when py2exe would not. I found it easier to use.

    http://www.pyinstaller.org/

    Pyinstaller is based on Gordon McMillan's Python Installer. Which is no longer available.

    0 讨论(0)
  • 2020-11-22 11:39

    For the GUI itself:

    PyQT is pretty much the reference.

    Another way to develop a rapid user interface is to write a web app, have it run locally and display the app in the browser.

    Plus, if you go for the Tkinter option suggested by lubos hasko you may want to try portablepy to have your app run on Windows environment without Python.

    0 讨论(0)
提交回复
热议问题