Is this a wx bug?

C

Chris Carlen

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
(e-mail address removed)
NOTE, delete texts: "RemoveThis" and
"BOGUS" from email address to reply.
 
K

kyosohma

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
(e-mail address removed)
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
 
K

kyosohma

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
(e-mail address removed)
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,982
Messages
2,570,185
Members
46,736
Latest member
AdolphBig6

Latest Threads

Top