[wxPython-users] "Pushing" Data to Modules

Robin Dunn robin at alldunn.com
Sun Dec 3 16:26:47 PST 2006


Rich Shepard wrote:
> On Fri, 1 Dec 2006, Josiah Carlson wrote:
> 
>> wx.lib.pubsub
> 
>   Re-reading the MVC section in the wPIA book, I see that wx.lib.pubsub is
> the appropriate class for me. The API docs are rather sparse, and I did not
> find more detailed descriptions in my Google search.
> 
>   The event I want to "publish" now from the module with the database
> methods is that a database connection has been established to an existing
> file. The subscribers are in different modules, each of which holds the
> widgets and bound methods for a notebook page.
> 
>   Does anyone have -- or have a reference to -- an application that uses
> this library in multiple modules/classes? It would make my learning and
> understanding much easier if I could look at a working example more complex
> than the simple one (for the AbstractModel() class) in the book.

With pubsub it works exactly the same way in a multi-module app as it 
does with a single module app.  You simply have one part of the 
application that subscribes to receive messages of certain topics, and 
another part of the application that publishes messages with those 
topics.  It doesn't matter if they are in the same module or even the 
same class, or not.


-- 
Robin Dunn
Software Craftsman
http://wxPython.org  Java give you jitters?  Relax with wxPython!





More information about the wxpython-users mailing list