[wxPython-users] how to do multi-window interactions?
Paul Sijben
sijben at eemvalley.com
Wed May 2 01:20:30 PDT 2007
thanks I will go and play with that
Jorgen Bodde wrote:
> If I understood your problem correctly, I think wx.lib.pubsub is what
> you are looking for.
>
> What I do in my app is subscribing to a global Publisher() class which
> distributes the sent message to all listeners.
>
> Simply do something like this;
>
> from wx.lib.pubsub import Publisher
>
> in frame #1
>
> def __init__(self, ...):
> Publisher().subscribe( self.__OnCommit, ('signal', 'commit') )
>
> def __OnCommit(self, message):
> print 'Received dat:', message.data
>
> And in frame #2 on the commit button for example;
>
> def __OnCommitButton(self, event):
> # the __mObjectData is a class passed to frame #1
> Publisher().sendMessage( ('signal', 'commit'), self.__mObjectData)
>
> This way you can send to frame #1, and when you require sending to
> frame #2 from frame #1 you can make another signal type (the tuple
> ('signal', 'commit') ) which it listens to.
>
> HTH,
> - Jorgen
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: wxPython-users-unsubscribe at lists.wxwidgets.org
> For additional commands, e-mail: wxPython-users-help at lists.wxwidgets.org
--
Paul Sijben tel: +31334566488
Eemvalley Technology fax: +31334557523
the Netherlands http://eemvalley.com
More information about the wxpython-users
mailing list