Archive for June, 2010

I see a number of questions on the wxPython mailing list or its IRC channel about communicating between frames and most of the time what the developer needs is the PubSub module. The Publisher / Subscriber model is a way to send messages to one or more listeners. You can read about it here. The Observer pattern is said to be based on the Publish / Subscribe pattern. In wxPython land, we have the pubsub module which can be accessed from wx.lib.pubsub. It’s actually included in wxPython, but you can also download it as a standalone module from its Source Forge. An alternative to pubsub is the PyDispatcher module.

Anyway, in this article we won’t be studying the theory behind either of these modules. Instead, we’ll use a semi-practical example in wxPython to show how to use the built-in version of pubsub to communicate between two frames. If you’re still with me at this point, then I encourage you to read on! (more…)

Dialogs are an integral part of user interface design. We use them all the time. We find dialogs everywhere, in many shapes and sizes. In this article we will cover the following dialog types:

  • wx.BusyInfo
  • wx.ColourDialog
  • CubeColourDialog (AGW)
  • wx.DirDialog and MultiDirDialog (AGW)
  • wx.FileDialog
  • wx.FontDialog
  • wx.MessageDialog

That’s a lot of dialogs, but there’s still eight more in the wxPython demo. We’ll look at those next time. For now, let’s take a look at this list! (more…)

Every couple of months, I’ll see someone asking how to switch between two views or panels in a wxPython application that they’re working on. Since this is such a common question and because I had it asked last week on the wxPython channel on IRC, I wrote up a quick script that shows how it’s done. Note that in most cases, the user will probably find one of the many notebook widgets to be more than sufficient for their needs. Anyway, let’s take a look at how to do this thing! (more…)

In the last article, we covered a wide variety of buttons that come with the standard wxPython package. Now we’re going to look at a whole bunch more! In case you haven’t figured it out yet, wxPython takes Python’s “batteries included” philosophy very seriously! In this post we’ll look at the following buttons:

  • wx.RadioButton
  • wx.SpinButton
  • AquaButton (AGW)
  • GradientButton (AGW)
  • ShapedButton (AGW)

Let’s get cracking! (more…)

Most people don’t really think about the widgets they use every day. Instead, they just take them for granted. The button is one of the most commonly used widgets that we use. From the keys on our keyboards to the buttons on door locks, we find them everywhere. They are even more prevalent in software where buttons can be practically any shape or size. Some buttons don’t even look like buttons! In this article, we’ll look at several buttons that wxPython provides for you and how to use them. (more…)

Last year I needed to figure out a way to get the following information with Python: get the route table, capture the data from pinging a series of IPs, run tracert and get information about the NIC(s) installed. This all needed to be done on a Windows machine as it was part of a diagnostics script to try to figure out why the machine (usually a laptop) wouldn’t connect to our VPN. I ended up creating a wxPython GUI to make it easy for the user to run, but these scripts will work just fine without wx. Let’s see what they look like! (more…)

We had our June Pyowa meeting last night in Ames, IA. There were NINE people in attendance, which is pretty big for our group. I think we’ve only managed that number of people on only one other occasion. Thanks goes out to everyone who spread the word and invited their friends.

At the meeting, I demoed a wxPython music player that I’ve been working on for around a month. It uses the cross-platform mplayer as its backend and wxPython for the front. Right now it allows the user to load a folder of mp3s into a custom list control (technically an ObjectListView widget instance) and play them one-by-one by either pressing the play button after selecting a track or by double-clicking a track. The player also displays cover art (if available), has a volume control and a playback slider.

Before I even started that demo though, I was asked about creating executables using py2exe, so I did an impromptu presentation on that subject using GUI2Exe. I rediscovered py2exe’s dislike of egg files when I tried to build the exe, so I had to unzip those so it could find the modules it needed for the project. Once that was done, the program compiled nicely.

Next time, we’ll be meeting in West Des Moines at the IMT Group building. Pizza and pop will be provided, so come hungry! The talks will be about Django, TurboGears and (maybe) SWIG. That will be happening on the 1st of July. I hope you can make it!