event.GetEventType() corresponds to a number. These numbers are not
the same under win/linux. So when I use;
event.GetEventType()==10097 will return True under linux when the left
mousebutton was clicked. Under windows another number corresponds with
wx.EVT_LEFT_DOWN, and so the comparison will return False.
After some asking at the #wxwidgets channel, it seems that in
wxwidgets one can use:
event.GetEventType()==wx.EVT_LEFT_DOWN
However, this is not possible under wxpython. Is a somewhat similar
approach possible in wxpython?
Thanks in advance!
Bart Smeets
note:
It seems that print int(wxEVT_LEFT_DOWN) in wxwidgets prints the
corresponding number, in wxpython however it prints:
TypeError: int() argument must be a string or a number, not
'PyEventBinder'
event.GetEventType() corresponds to a number. These numbers are not
the same under win/linux. So when I use;
event.GetEventType()==10097 will return True under linux when the left
mousebutton was clicked. Under windows another number corresponds with
wx.EVT_LEFT_DOWN, and so the comparison will return False.
Don't do that, there are constants for the event types.
After some asking at the #wxwidgets channel, it seems that in
wxwidgets one can use:
event.GetEventType()==wx.EVT_LEFT_DOWN
However, this is not possible under wxpython. Is a somewhat similar
approach possible in wxpython?
The above will not work because the wx.EVT_FOO is the event binder callable and your comparing it to the type value. You need to compare against the type as mentioned above. All the event types start with wx.wxEVT_ the event type constant is typically the same name as the event binder except for command events that have the wx.wxEVT_COMMAND_ prefix.
On Jul 11, 3:22 pm, Cody Precord <codyprec...@gmail.com> wrote:
Hello,
On Jul 11, 2009, at 7:56 AM, Bart wrote:
> Hello,
> event.GetEventType() corresponds to a number. These numbers are not
> the same under win/linux. So when I use;
> event.GetEventType()==10097 will return True under linux when the left
> mousebutton was clicked. Under windows another number corresponds with
> wx.EVT_LEFT_DOWN, and so the comparison will return False.
Don't do that, there are constants for the event types.
> After some asking at the #wxwidgets channel, it seems that in
> wxwidgets one can use:
> event.GetEventType()==wx.EVT_LEFT_DOWN
> However, this is not possible under wxpython. Is a somewhat similar
> approach possible in wxpython?
The above will not work because the wx.EVT_FOO is the event binder
callable and your comparing it to the type value. You need to compare
against the type as mentioned above. All the event types start with
wx.wxEVT_ the event type constant is typically the same name as the
event binder except for command events that have the wx.wxEVT_COMMAND_
prefix.
event.GetEventType() corresponds to a number. These numbers are not
the same under win/linux. So when I use;
event.GetEventType()==10097 will return True under linux when the left
mousebutton was clicked. Under windows another number corresponds with
wx.EVT_LEFT_DOWN, and so the comparison will return False.
Don't do that, there are constants for the event types.
After some asking at the #wxwidgets channel, it seems that in
wxwidgets one can use:
event.GetEventType()==wx.EVT_LEFT_DOWN
However, this is not possible under wxpython. Is a somewhat similar
approach possible in wxpython?
The above will not work because the wx.EVT_FOO is the event binder callable and your comparing it to the type value. You need to compare against the type as mentioned above. All the event types start with wx.wxEVT_ the event type constant is typically the same name as the event binder except for command events that have the wx.wxEVT_COMMAND_ prefix.
I added the typeId property to the event binders a while back because of the inconsistencies in the names of the event types in wx. This way you don't need to guess or look up what the name is because the binder already knows what the value is.