pusheventhandler

hello i'm trying to subvert the self._tc.PushEventHandler(BlankHandler) in the Create method of a derived grid editor and push my own blank event, but i keep getting the error
TypeError: argument number 2: a 'wxEvtHandler *' is expected, 'type(<class 'Main.BlankHandler'>)' is received

here is my eventhandler.

class BlankHandler(wx.EvtHandler):
    def __init__(self):
        wx.EvtHandler.__init__(self)
        "i do nothing"

Timothy Smith wrote:

hello i'm trying to subvert the self._tc.PushEventHandler(BlankHandler) in the Create method of a derived grid editor and push my own blank event, but i keep getting the error
TypeError: argument number 2: a 'wxEvtHandler *' is expected, 'type(<class 'Main.BlankHandler'>)' is received

The message is a little cryptic, but all the info you need is there. It's telling you that you are passing a type object, (IOW, a class) and not a wx.EvtHandler object (IOW an instance of the class) like expected. Change it to self._tc.PushEventHandler(BlankHandler()).

here is my eventhandler.

class BlankHandler(wx.EvtHandler):
   def __init__(self):
       wx.EvtHandler.__init__(self)
       "i do nothing"

Or even better, toss out this class and just do this: self._tc.PushEventHandler(wx.EvtHandler())

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!