Archive for December, 2009

During the summer, I stumbled upon an article on Ars Technica about using PyGTK to create a URL shortener. I thought that was pretty interesting, but I don’t use PyGTK. So at that point, I decided to write my own using wxPython and use the article’s code to do the shortening. I hacked together something pretty quickly and then put this article on the back burner and kind of forgot about it. Today, I decided to go ahead and finish it and also create an application that can shorten URLs using other popular URL shorteners. (more…)

The wxPython ListCtrl is a very handy widget. Unfortunately, it can be a pain to use as well. This discovery caused Phillip Piper, missionary to Mozambique, to write ObjectListView, a wrapper for the wx.ListCtrl. ObjectListView actually adds functionality because it uses objects to create its rows and thus, it makes gettings information from multiple columns much easier. Mr. Piper also added lots of other conveniences that makes adding custom editors easier, alternating the color of rows, automatically sorts rows, and much, much more! This article will help you learn some of the basics of using ObjectListView so that you’ll be able to use it in your future projects. This is not meant to be an exhaustive look at the control as it is actually very well documented. (more…)

In the first part of this series, I wrote on all the non-agw notebook widgets included with wxPython. For this second article, I will be focusing on the two notebooks that are in the AGW library of wxPython. AGW stands for Advanced Generic Widgets, a set of widgets that are written in Python instead of wrapped C++ code. I personally think that AGW is also a callback to its amazing author, Andrea Gavana. Regardless, the two widgets in this review will be the FlatNotebook and another AUI Notebook. The FlatNotebook has a great demo and I will spend most of this article on demos I’ve created that are based on it. The AUI Notebook is a part of agw.aui. While the demo for agw.aui is cool, it focuses on AUI in general, not the notebook. So I’ll just show you what I can glean from that. Now, let’s get cracking!

Update: The API changed slightly when it comes to AGW-related widgets. Basically some style flags in wxPython 2.8.11.0+ now require the agw-specific style flags. To use them, you’ll need to use the agwStyle keyword. See Andrea’s docs for more info: http://xoomer.virgilio.it/infinity77/AGW_Docs/ If you run into an error, try changing that first or post to the mailing list.

(more…)

If you’re new to GUI programming (and wxPython in particular), you may not know what a “book” control is. It may be that other languages call this control something different too. In wxPython, a book control allows the user to switch between various panels. The most common examples are browsers and system option dialogs with tabbed interfaces. This article will walk you though the creation and basic configuration of these controls. (more…)