Xlib: unexpected async reply (sequence 0x76b)!

Robert,

I wrote a simple wxPython GUI program. It has a frame, and on the frame I put a panel. And on the panel 3 buttons, start, stop, exit. I also plot on the panel a static bitmap. What I want is to plot continuously in a certain frequency images till the user press the stop button. Therefore I use a thread with a callback function. On windows my program runs very well with no problem at all. But when I start it on windows and press the start button I get the following strange error
Xlib: unexpected async reply (sequence 0x76b)!
I've searched on the internet and saw that this problem may be cause when you write things to your frame from the thread. But I thought that I was not doing this as I use a wx.PostEvent to refresh my image on the frame. Could someone please help me out with this problem. Her below I post the python script I have.
I wanted to know also how I disable the (x) fucntionality on my main frame so that the user is obliged to close the program by pressing the exit button. Or is there a way to activate the exit function bind to the exit button when the user pressed the (x) sign on the main frame window ?
Many thanks in advance.

<snip>

Probably the easiest way to disable the (x) at the corner of your application is to create the Frame with style=wx.SYSTEM_MENU. Of course, this also gets rid of the minimize and maximize buttons. You can add those by doing this though:

style=wx.SYSTEM_MENU | wx.MINIMIZE_BOX | wx.MAXIMIZE_BOX

Or you could just subclass from wx.Dialog instead of wx.Frame. There's also the option of catching the close event ( EVT_CLOSE ) and do something in the handler, but this can be a pain if you're not careful.

Mike