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.
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++.
Like Python and wxWidgets, wxPython is Open Source which means that it is free for anyone to use and the source code is available for anyone to look at and modify. Or anyone can contribute fixes or enhancements to the project.
wxPython is a cross-platform toolkit. This means that the same program will run on multiple platforms without modification. Currently supported platforms are 32-bit Microsoft Windows, most Unix or unix-like systems, and Macintosh OS X+, in most cases the native widgets are used on each platform.
Since the language is Python, wxPython programs are simple, easy to write and easy to understand.
As an example, this is a simple “Hello World” program with wxPython:
import wx app = wx.App() frame = wx.Frame(None, -1, "Hello World") frame.Show() app.MainLoop()
The GUI layouts you can build with wxPython are almost infinite: it has an extremely rich set of widgets (derived from wxWidgets) and greatly extended by a huge set of pure-Python controls written over the years.
Like any other complex piece of software, wxPython requires other software in order to function properly. Obviously you’ll need Python itself, but if you’re reading this you’ve probably already got Python and are just here looking for the best GUI toolkit available for Python. Check out the details for your platform of choice here:
wx.glcanvas.GLCanvasclass only provides the GL Context and a wx.Window to put it in, so if you want to use the wxGLCanvas you will also need the PyOpenGL Python extension modules as well.
The first thing you’ll need are the glib and gtk+ libraries. Before you run off and download the sources check your system, you probably already have it. Most distributions of Linux come with it and you’ll start seeing it on many other systems too now that Sun and others have chosen GNOME as the desktop of choice. If you don’t have glib and gtk+ already, you can get the sources here. Build and install them following the directions included.
In order to use the wxGLCanvas you’ll need to have either OpenGL or the Mesa3D library on your system.
wx.glcanvas.GLCanvas only provides the GL Context and a
Window to put it in, so you will also need the PyOpenGL
Python extension modules as well, if you want to use OpenGL.
If you are building wxPython yourself and don’t care to use OpenGL/Mesa then you can easily skip building it and can ignore this step. See the build instructions for details.
The wxPython binaries for OSX are mountable disk images. Simply double click to mount the image and then run the installer application in the image. Download the image that matches the version of Python that you want to use it with, and unless you know for sure that you need the ansi build please get the Unicode build.
You can download the Prebuild binary of wxPython which includes the source code for wxPython.
Prebuilt binaries are available for Microsoft Windows, Linux and Mac OS X.
Don’t forget to download the wxPython demo and the documentation!
If you are a very keen developer, you can get the source code and other project files from the wxWidgets/Phoenix Github repository. Be sure to read the README.rst file there to learn how to build wxWidgets and Phoenix for yourself.