Is this a wx bug?

kyosohma at gmail.com kyosohma at gmail.com
Wed Oct 24 20:57:02 EDT 2007


On Oct 23, 7:06 pm, Chris Carlen <crcarleRemoveT... at BOGUSsandia.gov>
wrote:
> Hi:
>
> #!/usr/bin/env python
>
> """From listing 3.3 in 'wxPython in Action'
> Demonstrates that something funny happens when you click&hold in the
> frame, then drag the mouse over the button window.  The
> wx.EVT_ENTER_WINDOW event is missed.  The wx.EVT_LEAVE_WINDOW event is
> NOT missed when you click&hold the mouse button over the button, and
> leave the button window."""
>
> import wx
>
> class MouseEventFrame(wx.Frame):
>      def __init__(self, parent, id):
>          wx.Frame.__init__(self, parent, id, title="Listing 3.3",
> 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)
>
>      # This is not critical to demonstrating the 'bug', but just provides
>      # feedback that the wx.EVT_BUTTON events are working correctly
>      # in relation to entering/leaving the button window.
>      def OnButtonClick(self, event):
>          if self.panel.GetBackgroundColour() == "Green":
>              self.panel.SetBackgroundColour("Red")
>          else: self.panel.SetBackgroundColour("Green")
>          self.panel.Refresh()
>
>      def OnEnterWindow(self, event):
>          self.button.SetLabel("Over")
>          event.Skip()
>
>      def OnLeaveWindow(self, event):
>          self.button.SetLabel("Not over")
>          event.Skip()
>
> if __name__ == '__main__':
>      app = wx.PySimpleApp()
>      frame = MouseEventFrame(None, id=-1)
>      frame.Show()
>      app.MainLoop()
>
> --
> Good day!
>
> ________________________________________
> Christopher R. Carlen
> Principal Laser&Electronics Technologist
> Sandia National Laboratories CA USA
> crcarleRemoveT... at BOGUSsandia.gov
> NOTE, delete texts: "RemoveThis" and
> "BOGUS" from email address to reply.

I cannot replicate this issue. It works correctly for me with Python
2.4, wxPython 2.8.4.2 (msw-unicode) on Windows XP SP2.

What version of Python/wxPython are you using? OS? It may just be that
you need to upgrade your wxPython or it's a bug on Mac/Linux. You
should post this to the wxPython mailing group here: http://www.wxpython.org/maillist.php

Mike




More information about the Python-list mailing list