First minute tutorial


Starting python programming is really easy, but it could be easier if we were able to use a graphical interface to access its capabilities. With this tutorial you will run yout first python graphical application in less than one minute!

Step 1: Install Python

For our purposes, best Python version is 2.6. Download it from one of the following links:
Windows Installer, Windows AMD64 Installer, Mac Installer. Ubuntu users should have Python 2.6 preinstalled.

For more installer packages visit the official Python release page.

Step 2: Install wxPython

Install wxPython runtime. If you installed Python 2.6, you may want to download one of these installers:

Windows Installer, Windows 64 Installer, Mac Installer. Ubuntu users follow these instructions.

For more installing options visit the official wxPython download page.

Step 3: Install wxFormBuilder

Install wxFormBuilder version 3.1 or above. Note: there is currently no stable version, so for now you must install the beta version:

Windows Installer, Mac Installer (coming soon), Ubuntu package (coming soon).

For more info on wxFormBuilder visit its official page.

Step 4: Download the template application

Download and unzip this template application. You can already launch contained inside and see the template application.

Step 5: Customize the graphical user interface

The gui can be customized with wxFormBuilder. It is very easy to understand how to place controls and to bind events handlers. Use the sample controls provided.

Step 6: Customize event handlers

Each control provides a set of predefined events. With wxFormBuilder it is easy to bind handlers (i.e. functions) to events:

Once you bind the handler save the project and generate code (F8). Then define the bound function in

That’s it!

Did you actually spend one minute?

17 Responses to First minute tutorial

  1. Alexei Vinidiktov says:

    Fantastic! Thanks for the write-up.

  2. rob0 says:

    Great. I’d love to see something a little longer or maybe the 2nd minute.

    Also perhaps the 3rd or 4th minute could be creating a frozen binary (aka .exe) for distributing.

    Also the example you have has a small bug in it, File->Exit calls wx.Close() which at least for me generated an error – by looking at the rest of the code it seems the correction involves using self.

    def m_mniExitClick( self, event ):

    • gianky says:

      Thank you for the feedback. I have corrected the bug.
      Actually, as soon as possible I’d like to add more sections, and a rss feed to announce new topics.

  3. rob0 says:

    Thanks again for this page.

    I’ve spent the past 1.5 weeks getting up to speed on wxPython after coming across this page. I’ve since been able to put together a great looking GUI for my companies beta test.

    I recommend ‘wxPython In Action” to anyone else thinking of following this route, its a great book for introducing wxPython (well the only one really, but it’s very readable).

  4. Tim says:

    Thanks for the tutorial. Any chance you could make an example of how to use a grid object with PyGridTableBase as the grid data source? When a grid is included on a form I can’t find a way to load the grid. thanks for any pointers you can give.

  5. Andy says:

    Excellent tutorial.. I was struggling until I found this. Your page and template need to be referenced from the FormBuilder site. Thank you so much.

  6. K. C. says:

    wxFormBuilder with Python is exactly what I have been looking for! Thank you. You have just made my next IDE.

  7. Mario Lacunza says:

    You save me! for some reason I make some mistakes in the event handlers..when I check your code I can fix my troubles

  8. patch says:

    Thanks for this great tutorial..i would love to see to become a webportal for more then wxframebuilder…

    maby a wiki, so myself and others can make some tutorials to share with others

    i have some friends that wants to learn would be easyer for me to write tutorials for a page like this…then show them…so i dont have to write a tutorial for all of them in a chat…since its some ppl’s..

    thanks :)

    • gianky says:

      Moving the portal to another site would be a bit difficult, I’m using Google Pages which is quick and free. There is already a wiki website for wxPython ( However, if you have in mind some specific tutorial, we can discuss by mail to see if it is a good candidate for a “2nd minute” topic.

      Edit: I just switched to WordPress…

  9. Mandy says:

    I did all the steps as you have mentioned. But i was not able to run the application.
    Your last step is define the bound function in, which is already defined in my case after i open I still didn’t get how to actually run the application.

    • gianky says:

      Hi, if you unzip the template and launch (not the program should run without any modification. If the program works try to change the code inside the event handlers and launch it again. Launch from the console, so you can see the traceback in case of errors. When the application is finished and debugged, rename to main.pyw to execute the application without the console.

  10. Werner says:

    Very nice!

    Just started to look at wxFB, I currently use wxPython and wonder can’t figure out how custom controls/widgets are defined. E.g. if I would want to use wx.lib.agw.aui, what would I have to put into “class” “declaration” etc under CustomControl properties?

    Would be great to see a bit more wxPython specific information.

    • gianky says:

      Actually, I think that wxFB developers are planning to release a new version with aui support, and I’m not really an expert programmer, so I think you should refer to wxPython or wxFB support.
      In any case think to the custom control as a quick way to add custom code to yout gui application. The class, declaration, construction, include and settings fields are simply placeholders for such code. Maybe names are confusing for python users because they are more C-stylish.
      For wxPython all you need is the import statement in the include field, i.e. import customlibrary, the name m_mycustom, and the construction statement self.m_mycustom = CustomLibraryClass(...). It is important that CustomLibraryClass is derived from the wxWindow class. The only additional code, that will be autogenerated, will add the instance that you constructed, with the name you specified, to the parent sizer.
      Hope it helps.

  11. JEFF says:

    yea it took me 44 hours to learn the first step. and 60 to learn the second and 2 days to learn the third, and uhh 3 months to learn the 4 th, and uhh 1 year to learn the 5th, and the final step took me 23 years. Has it been up that long?

Comments are closed.