Python GUI Applications

GTk

PyGTK provides Python bindings for the GTK+ toolkit. Like the GTK+ library itself, it is currently licensed under the GNU LGPL. It is worth noting that PyGTK only currently supports the Gtk-2.X API (NOT Gtk-3.0). It is currently recommended that PyGTK not be used for new projects and that existing applications be ported from PyGTK to PyGObject.

PyGObject aka (PyGi)

PyGObject provides Python bindings, which gives access to the entire GNOME software platform. It is fully compatible with GTK+ 3. Here is a tutorial to get started with Python GTK+ 3 Tutorial.

API Reference

Kivy

Kivy is a Python library for development of multi-touch enabled media rich applications. The aim is to allow for quick and easy interaction design and rapid prototyping, while making your code reusable and deployable.

Kivy is written in Python, based on OpenGL and supports different input devices such as: Mouse, Dual Mouse, TUIO, WiiMote, WM_TOUCH, HIDtouch, Apple’s products and so on.

Kivy is actively being developed by a community and is free to use. It operates on all major platforms (Linux, OSX, Windows, Android).

The main resource for information is the website: http://kivy.org

PyObjC

Only available on OS X. Don’t pick this if you’re writing a cross-platform application.

PySide

PySide is a Python binding of the cross-platform GUI toolkit Qt.

pip install pyside

https://wiki.qt.io/Category:LanguageBindings::PySide::Downloads

PyQt

If your software does not fully comply with the GPL you will need a commercial license!

PyQt provides Python bindings for the Qt Framework (see below).

http://www.riverbankcomputing.co.uk/software/pyqt/download

PyjamasDesktop (pyjs Desktop)

PyjamasDesktop is a port of Pyjamas. PyjamasDesktop is application widget set for desktop and a cross-platform framework. (After release v0.6 PyjamasDesktop is a part of Pyjamas (Pyjs)). Briefly, it allows the exact same Python web application source code to be executed as a standalone desktop application.

Python Wiki for PyjamasDesktop.

The main website; pyjs Desktop.

Qt

Qt is a cross-platform application framework that is widely used for developing software with a GUI but can also be used for non-GUI applications.

Tk

Tkinter is a thin object-oriented layer on top of Tcl/Tk. It has the advantage of being included with the Python standard library, making it the most convenient and compatible toolkit to program with.

Both Tk and Tkinter are available on most Unix platforms, as well as on Windows and Macintosh systems. Starting with the 8.0 release, Tk offers native look and feel on all platforms.

There’s a good multi-language Tk tutorial with Python examples at TkDocs. There’s more information available on the Python Wiki.

wxPython

wxPython is a GUI toolkit for the Python programming language. It allows Python programmers to create programs with a robust, highly functional graphical user interface, simply and easily. It is implemented as a Python extension module (native code) that wraps the popular wxWidgets cross platform GUI library, which is written in C++.

Install (Stable) wxPythongo to http://www.wxpython.org/download.php#stable and download the appropriate package for your OS.

Article original from: http://docs.python-guide.org/en/latest/scenarios/gui/#gtk

6 Python Libs you will want to use.

Pyglet

What it is: Pyglet is cross-platform framework for multimedia and windows graphics in pure Python.

Why you need it: It provides handy access to items that are tedious to implement from scratch for a GUI application: window functions, OpenGL graphics, audio and video playback, keyboard and mouse handling, and working with image files. (It doesn’t provide UI widgets like buttons, toolbars, or menus, though.)

All of this is done through the native platform capabilities in Windows, OS X, or Linux, so there are no binary dependencies; it’s pure Python. It’s also BSD-licensed, so it can be included in any commercial or open source project.

Peewee

What it is: Peewee is a small but powerful library for accessing databases by way of an ORM, with native support for SQLite, MySQL, and PostgreSQL.

Why you need it: Any application that uses external data in more than a trivial manner typically uses a database, but getting and setting data from a database via ad hoc connection strings is asking for trouble.

Peewee provides a safe, programmatic path to access database resources, using a set of Python classes that are intuitive for both Python developers and database engineers. With Peewee, a quick-and-dirty way to access a database can be later expanded to a more robust option without having to rip it out and start over. Transactions are natively supported, and optional modules provide support for everything from connection pooling to advanced field types like many-to-many.

Bottle

What it is: Bottle is a tiny, lightweight Web framework that’s also quite fast.

Why you need it: When you simply want to throw together a quick RESTful API or use the bare bones of a Web framework to build an app, Bottle gives you no more than you need. Routing, templates, access to request and response data, support for multiple server types from plain old CGI on up, and support for more advanced features like WebSockets — it’s all here.

The amount of work needed to get started is minimal, and Bottle’s design is elegantly extensible for when more advanced functions have to be plugged in.

Invoke

What it is: « Pythonic remote execution » — in plainer English, Invoke allows you to perform admin tasks using a Python library.

Why you need it: Who wouldn’t want a « clean, high-level API for running shell commands and defining/organizing task functions »? Using Python as a replacement for common shell scripting tasks makes sense, and Invoke provides common-sense solutions to take command-line tasks and manage them as if they were Python functions, allowing bigger items to be elegantly built around them.

Note that Invoke’s version as of this writing is considered pre-release software; if you want something guaranteed stable (if no longer being actively developed), consider Invoke’s predecessor, Fabric.

Splinter

What it is: Splinter is a Python library for testing Web applications by automating interactions with them.

Why you need it: Let’s face it — little is less fun than trying to automate Web application testing. Splinter automates everything end to end, invoking the browser, passing URLs, filling out forms, clicking buttons, and so on.

It requires drivers to work with a specific browser, but Chrome and Firefox are already covered, and it can use Selenium Remote to control a browser running elsewhere. You can even manually execute JavaScript in the target browser.

Splinter is useful if you want to find out how specific browsers behave when confronted with a given website. For automating site interactions without a browser — essentially a kind of curl on steroids — check out Twill.

Arrow

What it is: The Arrow library sorts out the mess that is Python’s date/time handling.

Why you need it: Dealing with time zones, date conversions, date formats, and all the rest are a headache and a half. With Python’s standard library for date/time work, you get two headaches.

Arrow provides four big boons, all useful in the short and the long term. One, it’s a drop-in replacement for Python’s datetime module, meaning common function calls like .now() and .utcnow() work as expected. Two, it provides methods for common needs like shifting or converting timezones. Three, it provides « humanized » date/time information — such as being able to say something happened « an hour ago » or will happen « in two hours » without a lot of effort. Four, it can localize date/time information without breaking a sweat.