We have had a lot of questions on the newsgroup asking how to go about learning wxPython. This page gives some pointers on how to do just that.

Learn Python

If you are new to Python, and especially if you are new to programming in general, it makes the most sense to learn Python first, without any GUI stuff. The wait can be frustrating, but it is worth it. Python is a very powerful language capable of doing many things both with and without GUIs.

At a minimum, you should understand topics such as functions, modules, and classes. Without those, learning wxPython will be a frustrating experience. The Python website has an excellent guide for beginners that takes you step-by-step through the process of learning the language. http://www.python.org/about/gettingstarted/

Choose a good editor

Features such as auto-completion, code highlighting, and an interactive window make for faster programming with less errors.

Read the wxPython Style Guide

It will serve you well to use a nice, modern style for your wxPython code. Due to API changes over the years, and just plain experience, wxPython code style has changed quite a bit over the years, and gotten much more Pythonic.

Unfortunately, a lot of the examples you'll find have not been updated to reflect this style. As you will benefit from using good, modern, style, make sure to study wxPython Style Guide right when you get started, to establish good habits.

Read the demo files

wxPython comes with a comprehensive set of demos and examples. Go to the download page and scroll down to the wxPython-demo-x.x.x files. The demo demonstrates nearly all the features of wxPython. You can see how different features work and study the source code.

NOTE: If the demos don't work, make sure you have the latest wxPython version installed. Sometimes demos use features not found in older versions. To check your wxPython version, run:

Use the wxWidgets documentation

It is written mainly in C++, but there are notes for wxPython and most of the time you can mentally convert from the C++ syntax to the wxPython syntax. You don't need to know C++ to benefit from this. A lot of wxPython programmers don't know any C++ at all, and they still find the wxWidgets documentation very useful.

Use the wxPython reference (experimental)

You can try the automatically generated API reference. This is an experimental feature. It is not as thorough or mature as the wxWidgets documentation, but it is written in wxPython syntax instead of C++ syntax.

Study other people's code

Charles Simonyi, the legendary Microsoft programmer, grew up in Hungary and had few books available to him from which to learn computer science. He was able to get the source code for a compiler and studied the printouts as musicians would study musical scores.

There are quite a few gems in the sample code that is distributed with wxPython but are not in the Demo program, e.g., FrogEdit and its underlying wx.lib.editor module. I had assumed that an editor would be a wx.TextCtrl on steroids. I was surprised to see that the text was drawn to the screen using a DC (device control) and learned some good techniques. I am also "reading" Transana and Task Coach, two sophisticated applications written in Python and wxPython, to learn how large applications are structured. There is a huge difference between the small examples on this wiki, and actual real-world code, so the process of analyzing large applications is integral to learning wxPython.