Re: Phoenix - wx.PyCommandEvent
Werner <[email protected]>
| Newsgroups | gmane.comp.python.wxpython.devel |
|---|---|
| Message-ID | <[email protected]> |
On 9/18/2015 18:41, Werner wrote:
> Hi,
>
> With Phoenix I see a problem with a custom event that the 'setter' is
> not called.
>
> The event is define like this:
>
> class ScEventDbItemSet(wx.PyCommandEvent):
> """Custom event to be notified when a dbItem is set on the control"""
> def __init__(self, evtType, id):
> wx.PyCommandEvent.__init__(self, evtType, id)
> self._dbItem = None
>
> @property
> def dbItem(self):
> return self._dbItem
>
> @dbItem.setter
> def dbItem(self, dbitem):
> self._dbItem = dbitem
>
> and I am using it like this:
>
> evt = ScEventDbItemSet(scEVT_SEARCHCTRL_DBITEMSET, self.GetId())
> evt.dbItem = item
> self.GetEventHandler().ProcessEvent(evt)
>
> Anyone knows why this is not working?
If I add this, as mentioned on
http://wxpython.org/Phoenix/docs/html/MigrationGuide.html?highlight=pycommandevent:
def __getattr__(self, name):
d = self._getAttrDict()
if name in d:
return d[name]
return getattr(self, name)
def __setattr__(self, name, value):
d = self._getAttrDict()
if name in d:
return d[name]
return setattr(self, name, value)
Then I get a RunTimeError: max recursion exceeded
I could go back to define Get/Set, but it would be nice to be able to
use properties.
Werner
>
> Werner
>
--
You received this message because you are subscribed to the Google Groups "wxPython-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/d/optout.