We have built a big wxPython application that currently uses wxPython 2.6.3.1.
(we have to convert the code from the old standard to the new, but more than
80k lines of wxPython is not that easy to convert)
We have a list and in that list under certain circumstances I want to fire an
event myself so that it gets propagated up the tree. I use the following
code:
Notice the evtType[0]. I have searched the mailinglist for this, but there is
no reference to this at all. Robin has given some examples but instead of the
evtType[0] he uses typeId, which doesn't work in my code. Is that because of
2.8 or is there something I simply don't understand?
We have built a big wxPython application that currently uses wxPython 2.6.3.1.
(we have to convert the code from the old standard to the new, but more than
80k lines of wxPython is not that easy to convert)
We have a list and in that list under certain circumstances I want to fire an
event myself so that it gets propagated up the tree. I use the following
code:
Notice the evtType[0]. I have searched the mailinglist for this, but there is
no reference to this at all. Robin has given some examples but instead of the
evtType[0] he uses typeId, which doesn't work in my code. Is that because of
2.8 or is there something I simply don't understand?
Cheers
D.Kniep
Looking at the docs for CommandEvent, the first argument is
"commandType". My guess is that when you call evtType[0] on the wx
event in your example, you get its commandType. When I looked up the
help for EVT_LIST_ITEM_SELECTED, I got the following information about
typeId:
"Make it easy to get to the default wxEventType typeID for this event
binder."
So it looks like Robin (or some other core dev) added a convenience
function to get the same information.
I'm sure he'll weigh in on the matter as well though.
···
On Mar 13, 4:41 pm, dick <dickkn...@gmail.com> wrote:
We have built a big wxPython application that currently uses wxPython 2.6.3.1.
(we have to convert the code from the old standard to the new, but more than
80k lines of wxPython is not that easy to convert)
We have a list and in that list under certain circumstances I want to fire an
event myself so that it gets propagated up the tree. I use the following
code:
BTW, do you realize that you are sending the event twice? ProcessEvent will search for and call the event handler (if found) before ProcessEvent returns. wx.PostEvent will add it to the pending event queue which will be processed in the next idle event.
This works as I want it to.
Notice the evtType[0]. I have searched the mailinglist for this, but there is
no reference to this at all. Robin has given some examples but instead of the
evtType[0] he uses typeId, which doesn't work in my code. Is that because of
2.8 or is there something I simply don't understand?
Yes, it was probably added in 2.8, but using it is exactly the same as what you are already doing with evtType[0]:
def _getEvtType(self):
"""
Make it easy to get to the default wxEventType typeID for this
event binder.
"""
return self.evtType[0]