create user message for wxPython

J

James Hu

Hi,

There are 2 wxPython application, A and B and need to exchange msg.
Sending WM_CLOSE, wxEVT_MOUSEWHEEL to B is OK, and sending user message
like 1225 from A to B is also OK.

But B didn't catch this message, note, B is running before A sends msg
and can receive "WM_CLOSE".

Do I have to make my own msg loop by using win32api, win32gui? I used
win32gui to post Message to other windows.

Using wx.Frame:

wx.EVT_START_MSG= 1225
EVT_START_MSG_EVENT= wx.PyEventBinder(wx.EVT_START_MSG, 0)


EVT_START_MSG_EVENT(self, self.OnStart)
Or
Self.Bind(EVT_START_MSG_EVENT,self.OnStart)

def OnStart(self, event):
print 'got start message'

Thanks a lot in advance!

James
 
F

Frithiof Andreas Jensen

Hi,
There are 2 wxPython application, A and B and need to exchange msg.

I do not think that wx even has a mechanism for sending events between
applications.?

You need some other tool, like a socket, a named pibe, some windows specific
event queue library (gack!), or maybe a toolkit like PYRO, SPREAD e.t.c.
depending on your *reason* for needing this in the first place.

I am partial to PYRO myself.

.... and you do need an event loop in any case to map from:

"remote event" <-> "message protocol" <-> "local event"

.... at least that makes it easier to test than "raw" event's which are
harder to control.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,269
Messages
2,571,338
Members
48,025
Latest member
Rigor4

Latest Threads

Top