Some kind of mailbox event?

Hi all,

I wanted to have some thoughts on this. I am using wxPython at work
now (great by the way!) but I am constantly writing inter-thread
communication code. The latest thing I need to do is set up a number
of scalable servers (that listen to a certain socket) that receive an
XML file and the GUI (wxPython) will have to process that.

The way it can be done is making a wx.Timer, and check something like
a thread safe queue for messages. But the GUI already runs in a
thread. That is constantly doing 'nothing' between events. It would be
nice if I get something like a wx.MailBoxEvent if there is an item in
a thread safe mailbox. Something like;

···

---
    # create a queue and a thread that uses the queue
    self.queue = queue.Queue()
    self._thread = thread.Thread(self.queue)

    self.Bind(wx.EVT_MAILBOX, self._onItemPresent, self.queue)
---

So when the main thread runs internally and senses that there are
items in the queue, it could call between events the _onItemPresent
handler. It would greatly improve the simplicity and also
responsiveness because checking on wx.Timer base always introduces a
lag.

Is something like this difficult to add to wxPython or can this be
done in a seperate more elegant way then the wx.Timer solution I
sketched? The advantage of this is that multiple queue's can be added
dynamically without much code overhead, and the main thread that runs
free most of the time will take care of notifications.

Regards,
- Jorgen