Tag Archives: IPC

wxPython and PubSub: A Simple Tutorial

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!

UPDATE: This article is for wxPython 2.8. If you happen to be using a newer version of wxPython, then you’ll want to read my newer version of this article here

Continue reading wxPython and PubSub: A Simple Tutorial