We have the answers to your questions! - Don't miss our next open house about the data universe!

wxPython : All about the Python wrapper for wxWidgets

- Reading Time: 4 minutes
wxPython : All about the Python wrapper for wxWidgets

wxPython is a Python wrapper for the wxWidgets GUI toolset. Find out all you need to know about it: presentation, operation, advantages, alternatives, training...

In 1995, Robin Dunn needed a cross-platform solution, a graphical user interface (GUI) application that could run on both HP-UX systems and Windows 3.1.

Consulting existing free and commercial solutions, he discovered Python bindings on the web page of the wxWidgets toolkit, then called wxWindows.

That’s how he discovered Python. With the help of fellow students Harri Pasanen and Edward Zimmerman, he set about developing a binding called wxPython.

What is Python?

Initially developed by Guido van Rossum and launched in 1991, Python is an interpreted, interactive, object-oriented programming language. It is often compared to Tcl, Perl, Scheme or Java and is inspired by the ABC and Haskell languages.

It is a high-level general-purpose language, but some prefer to call it a dynamic language. Simple to learn, Python owes its popularity to its minimalism.

Its syntax is similar to that of the English language. For example, it doesn’t use semicolons or parentheses. Today, Python is maintained by a large community of contributors worldwide.

In addition, Python offers numerous libraries and wrappers for existing tools in other languages. For creating graphical user interfaces (GUIs), the three main options are PyGTK, PyQt and wxPython.

What is wxPython?

wxPython is a wrapper for the wxWidgets graphical user interface (GUI) API for the Python language. This API is written in C++, so wxPython is essential for using it in Python. It’s an alternative to Tktinter, which comes as standard with Python.

This package can be imported at runtime, and includes a collection of Python modules and a native code extension module. It provides a series of Python classes similar to the wxWidgets classes.

The extension module mirrors the wxWidgets class hierarchy. For example, the wxFrame class in wxPython is very similar to the wxFrame class in the C++ version.

As a wrapper, wxPython uses the same free software license as wxWdigets: the wxWindows Licence. It is approved by the Free Software Foundation and the Open Source Initiative.

After version 0.2 in 1995, version 0.3 was released in August 1998. It was designed for wxWidgets 2.0 and ran on Win32. A wxGTK version was also developed for Unix/X-windows platforms.

Early versions of wxPython were created manually, but it became difficult to maintain the code and preserve synchronization with wxWidgets relaxes. From 1997 onwards, versions were created with SWIG to reduce the workload on updates.

What is Project Phoenix?

Announced in 2010, Project Phoenix aims to clean up wxPython while making it compatible with Python 3. It’s a new implementation of wxPython focused on speed, extensibility and maintainability.

Like previous versions of wxPython, this new project wraps the wxWidgets C++ toolkit and opens access to the user interface portions of the wxWidgets API. Starting with wxPython version 4.0.0a1 released in 2017, the Phoenix project became the official wrapper version.

What is wxPython?

The role of wxPython is to enable Python to be used to create cross-platform GUI applications without the need for platform-specific code.

It can also be used in situations where Python is integrated into a C++ application as a macro or internal scripting language.

It’s a useful tool for people who prefer Python to C++. It also enables rapid prototyping of wxWidgets applications, where C++ requires you to spend time on the compile-link-run cycle. In Python, this cycle is reduced to edit-run.

This means you can build an application in a matter of hours, instead of days with C++. Converting a wxPython application into a C++/wxWindgets application is also a simple task.

Well-known applications developed with wxPython include the personal information management system Chandler, the desktop clients of the Dropbox and Google Drive cloud storage services, the cross-platform text editor Editra, and the photo processing software Phatch.

Other examples include the GRASS GIS geographic information system, the PlayOnLinux and PlayOnMac front-ends for Wine, and the PsychoPy neuroscience tool.

Alternatives to wxPython

There are other GUI solutions for Python that can be used as alternatives to wxPython. First of all, Tkinter is the standard default GUI for Python, available on all platforms compatible with Python and Tcl/TK.

In fact, it’s a wrapper for Tcl’s Tk GUI toolkit. This toolkit is versatile, and can be used for a wide variety of use cases in a wide variety of environments.

Creating new widgets is easy, as is using them interchangeably in programs. On the other hand, Tkinter requires the use of two separate language interpreters: the Python interpreter, and the Tcl interpreter for the GUI.

In addition, Tcl is mainly dedicated to string processing and is therefore rather slow. Finally, Tkinter is a low-level, coding-intensive toolkit for tasks that can be simplified by abstraction.

Another alternative to wxPython is PythonWin: a Python add-on package for the Win32 platform. It includes wrappers for MFC and for a large part of the Win32 API. Programmers familiar with MFC and the Win32 API will be on familiar ground.

Of course, PythonWin is not compatible with other platforms and toolkits. It is organized in separate packages and modules, which can be used as needed without having to use the GUI portions.

Many other GUI modules for Python are available. Some are under active development, others have not been updated for a long time. Most are simple wrappers for C or C++ toolkits. Few are cross-platform. You can find the full list on the PyPi website.


wxPython is one of several Python wrappers for C and C++ GUI toolsets. To learn how to master the Python language and its wrappers, libraries or modules, you can choose DataScientest.

Our training courses include a module entirely dedicated to Python programming, alongside other modules dedicated to data analysis, DataViz or Machine Learning.

Through our various curricula, you’ll acquire all the skills you need to work as a Data Analyst, Data Engineer, Data Scientist, Machine Learning Engineer or Data Product Manager.

All our programs can be completed remotely via the web, and our state-approved organization is eligible for funding options. Discover DataScientest!

You are not available?

Leave us your e-mail, so that we can send you your new articles when they are published!
icon newsletter


Get monthly insider insights from experts directly in your mailbox