Ok, I don't know what I am doing wrong... Here is the smallest sample I could put together to demonstrate the problem. Does anyone have some suggestions about it?
Thank you
Andrea.
NotifyEvent.py (1.31 KB)
···
_________________________________________
Andrea Gavana (gavana@kpo.kz)
Reservoir Engineer
KPDL
4, Millbank
SW1P 3JA London
Direct Tel: +44 (0) 20 717 08936
Mobile Tel: +44 (0) 77 487 70534
Fax: +44 (0) 20 717 08900
Web: http://xoomer.virgilio.it/infinity77
¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
-----Original Message-----
From: Andrea Gavana [mailto:andrea.gavana@gmail.com]
Sent: 11 May 2006 00:18
To: wxPython-users@lists.wxwidgets.org
Subject: [wxPython-users] Subclassing wx.NotifyEventHello NG,
In an application I am trying to create, I have
subclassed wx.NotifyEvent in this way:wxEVT_MY_EVENT = wx.NewEventType()
EVT_MY_EVENT = wx.PyEventBinder(wxEVT_MY_EVENT, 1)class MyEvent(wx.NotifyEvent):
def __init__(self, eventType, id=1):
wx.NotifyEvent.__init__(self, eventType, id)
def GetItem(self):
return self._item
def SetItem(self, item):
self._item = item
And so forth. What I do in the event handler inside the
control, is this:event = MyEvent(wxEVT_MY_EVENT, self.GetId()) event._item = item
event.SetEventObject(self)
if self.ProcessEvent(event) and not event.IsAllowed():
# cancelled by program
returnIn the demo, this is what I do:
self.myobject.Bind(EVT_MY_EVENT, self.OnEvent)
def OnEvent(self, event):
item = event.GetItem()
# do other processingWhat I get is:
AttributeError: 'NotifyEvent' object has no attribute 'GetItem'
?!?!? ... First of all, it should not be 'NotifyEvent' but
'MyEvent', and secondly I have explicitely implemented the
function GetItem() inside the class... I am sure I am missing
something.
Could someone please give me a hint on what I am doing wrong?Thank you very much.
Andrea.
--
"Imagination Is The Only Weapon In The War Against Reality."http://xoomer.virgilio.it/infinity77/
---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail:
wxPython-users-help@lists.wxwidgets.org