Python3 crossplatform GUI toolkit

442 Views Asked by At

I need a OSX and GNU/Linux compatible GUI toolkit which works with python3.

I tried GTK3 with GObject introspection, but it was hard to be deployed on OSX. Is there something like gtk builder compatible which will run on OSX ?

What my requirements are:

  • XML based layout with an IDE builder
  • Runs on OSX (and be compatible or works out of the box on GNU/Linux)
  • Works on Python3
  • Not ugly as TK :) (kidding)
3

There are 3 best solutions below

3
On

You can use Qt in Python with PyQt. The advantage over Gtk is that it looks native on OS X (Qt uses Cocoa for rendering.)

More info: http://www.riverbankcomputing.co.uk/software/pyqt/intro/

If you're using Homebrew, you can install it quite easily:

brew install pyqt

Or you might find binaries on the PyQtX project page.

0
On

There aren't any that I know of. Is the Python 3 requirement necessary? If not, you might consider Qt and the PySide bindings, or Enthought's TraitsUI framework which builds on either Wx or Qt.

0
On

Final solution:

python3 using pyqt

  1. download the following MacOS pkg:

    http://sourceforge.net/projects/pyqtx/files/Complete/

  2. After installation

    we run the following sample python3 program:

Code to use:

#!/usr/bin/python3
# -*- coding: utf-8 -*-

import sys

from PyQt4 import QtCore, QtGui, uic

if we don't have any import error, then pyqt is working properly.

Tested on MacOS Lion 10.7.2

on GNU/Linux Python3 should have pyqt already working out of the box. Tested on Archlinux.