The example is broken:
b.bind(wx.EVT_BUTTON, self.on_cmd_click)
should be
b.Bind(wx.EVT_BUTTON, self.on_cmd_click)
and
self.Bind(EVT_GOO, self.on_cmd1, ID_CMD1)
self.Bind(EVT_GOO, self.on_cmd2, ID_CMD2)
should be
self.Bind(EVT_GOO, self.on_cmd1, id=ID_CMD1)
self.Bind(EVT_GOO, self.on_cmd2, id=ID_CMD2)
but still it doesn’t work. Here is the output from pressing all three buttons from top to bottom:
$ LD_LIBRARY_PATH=/home/thomasc/wxPython_Phoenix-2.9.5.81-r73744-src/build/lib.linux-i686-2.7/wx PYTHONPATH=/home/thomasc/wxPython_Phoenix-2.9.5.81-r73744-src/build/lib.linux-i686-2.7 python x.py
Exception in thread Thread-1:
Traceback (most recent call last):
File “/usr/lib/python2.7/threading.py”, line 552, in __bootstrap_inner
self.run()
File “/usr/lib/python2.7/threading.py”, line 505, in run
self.__target(*self.__args, **self.__kwargs)
File “x.py”, line 14, in evt_thr
wx.PostEvent(win, MooEvent(moo=1))
TypeError: wx._core.Event cannot be instantiated or sub-classed
Traceback (most recent call last):
File “x.py”, line 64, in on_cmd1
self.show("goo = %s" % e.goo, "Got Goo (cmd1)")
AttributeError: ‘CommandEvent’ object has no attribute ‘goo’
Traceback (most recent call last):
File “x.py”, line 67, in on_cmd2
self.show("goo = %s" % e.goo, "Got Goo (cmd2)")
AttributeError: ‘CommandEvent’ object has no attribute ‘goo’
^C