event.Skip() dosen't work on Windows?

Hello everyone!

I'm a newbies to wxPython, follow is a simple program I copied form

wxPython in action:

#!/usr/bin/env python

import wx

class MouseEventFrame(wx.Frame):

    def __init__(self, parent, id):

        wx.Frame.__init__(self, parent, id, 'Button',

size=(300,100))

        self.panel=wx.Panel(self)

        self.button=wx.Button(self.panel, label="Not Over",

pos=(100,15))

        self.Bind(wx.EVT_BUTTON, self.OnButtonClick, self.button)

        self.button.Bind(wx.EVT_ENTER_WINDOW, self.OnEnterWindow)

        self.button.Bind(wx.EVT_LEAVE_WINDOW, self.OnLeaveWindow)

    def OnButtonClick(self, event):

        self.panel.SetBackgroundColour('Green')

        self.panel.Refresh()

    def OnEnterWindow(self, event):

        self.button.SetLabel('Over Me!')

        self.panel.Refresh()

        event.Skip()

       

    def OnLeaveWindow(self, event):

        self.button.SetLabel('Not Over!')

      

if __name__=='__main__':

    app=wx.PySimpleApp()

    frame=MouseEventFrame(parent=None, id=-1)

    frame.Show()

    app.MainLoop()

I use wxPython2.8, It works well on my linux(Kubuntu 12.04), but

today when I test it on my windows(Windows 7), I find that Skip
methods doesn’t work, no matter I use Skip() or not, even use
Skip(False), the program was the same. Is Skip() platform denpends?
I needn’t use it on Windows Platform? I also want to get some
infomations about other platform, thanks!

Hi,

···

On Thu, Aug 23, 2012 at 12:57 AM, JerryOne <lwx169@gmail.com> wrote:

I use wxPython2.8, It works well on my linux(Kubuntu 12.04), but today when
I test it on my windows(Windows 7), I find that Skip methods doesn't work,
no matter I use Skip() or not, even use Skip(False), the program was the
same. Is Skip() platform denpends? I needn't use it on Windows Platform? I
also want to get some infomations about other platform, thanks!

Doesnt work how? What are you expecting to happen?

Skip just flags the event as not having been handled yet so that the
next handler in the chain (bound to that same event) will get called.

Cody

于 2012年08月23日 21:24, Cody 写道:

Hi,

I use wxPython2.8, It works well on my linux(Kubuntu 12.04), but today when
I test it on my windows(Windows 7), I find that Skip methods doesn't work,
no matter I use Skip() or not, even use Skip(False), the program was the
same. Is Skip() platform denpends? I needn't use it on Windows Platform? I
also want to get some infomations about other platform, thanks!

Doesnt work how? What are you expecting to happen?

Skip just flags the event as not having been handled yet so that the
next handler in the chain (bound to that same event) will get called.

Cody

On Linux, if I didn't call event.Skip(), wxPython only handle the first event in the chain(as you say). But on Windows, no matter I called event.skip() or not, wxPython will handle all the event. The program can works well, I'm just be interesting about the difference between two platforms . :slight_smile:

···

On Thu, Aug 23, 2012 at 12:57 AM, JerryOne <lwx169@gmail.com> wrote:

Hi,

···

On Thu, Aug 23, 2012 at 8:59 AM, JerryOne <lwx169@gmail.com> wrote:

于 2012年08月23日 21:24, Cody 写道:

On Linux, if I didn't call event.Skip(), wxPython only handle the first
event in the chain(as you say). But on Windows, no matter I called
event.skip() or not, wxPython will handle all the event. The program can
works well, I'm just be interesting about the difference between two
platforms . :slight_smile:

Do you have an example to reproduce this? I don't see any chain of
events in the previously posted example, just one event handler per
event type.

Cody

Hi
Thanks for you reminder, I find I have some misunderstanding about
the skip methods, and now I understand it better! The codes I
provide before is not appropriate, there’s no any event chain in it.
But that’s what I’m still puzzled about.The praogram works differend
on differend platform. The 2 events: enter window(button) and clcik
button actually has no contact, but on Linux only one will be
handled if I don’t use Skip(). It looks strange.

···

锟斤拷 2012/8/23 22:13, Cody 写锟斤拷:


Hi,
On Thu, Aug 23, 2012 at 8:59 AM, JerryOne wrote:
锟斤拷 2012锟斤拷08锟斤拷23锟斤拷 21:24, Cody 写锟斤拷:

On Linux, if I didn't call event.Skip(), wxPython only handle the first
event in the chain(as you say). But on Windows, no matter I called
event.skip() or not, wxPython will handle all the event. The program can
works well, I'm just be interesting about the difference between two
platforms . :-)


Do you have an example to reproduce this? I don't see any chain of
events in the previously posted example, just one event handler per
event type.
Cody
  <lwx169@gmail.com>