Hi
I’d like to catch the same command event in two classes. I mean i have a button in a class derived from wxScrolledWindow. This button has an event (click) handler in the class. I’d like to add another handler in an upper class so that the two handlers are called on a click on the button.
---- Sample code ---- :
from wxPython.wx import *
class thing:
def init(self,parent,h,w):
self.btn=wxButton(parent,-1,“tutu”,pos=(0,0),size=(h,w))
EVT_BUTTON(self.btn,self.btn.GetId(),self.OnClick)
def OnClick(self,event):
print “thing-click”
event.Skip()
class MyFrame(wxFrame):
def init(self,w,h):
wxFrame.init(self,parent=NULL,id=-1,title=“test”,size=(w,h),pos=(0,0))
self.testThing=thing(self,w,h)
EVT_BUTTON(self.testThing.btn,self.testThing.btn.GetId(),self.OnThingClick)
self.Show(true)
def OnThingClick(self,event):
print "waza-click"
event.Skip()
class MyApp(wxApp):
def OnInit(self):
test=MyFrame(200,200)
self.SetTopWindow(test)
return true
app = MyApp(0)
app.MainLoop()
---- end ----
When the button is pressed, i wanted “waza-click” and “thing-click” to be printed but only “thing-click” is printed.
How can i do to have both handlers working ?
Thanks
Pierre