Bug in wx.lib.buttons.GenToggleButton

There seem to be a bug in wx.lib.buttons.GenToggleButton. When you try to open a dialog in modal mode in an event caused by a toggle-button, the dialog doesn't receive input properly. See the attached example of the problem, test.py.

How I do to trigger it (using the example program):

Click the toggle me!-button, now I can write in the text control, but not click on "Ok" or "Cancel". Next I get focus to another window (which is not this program) and again focus the test program, now I can click on ok or cancel. Now I can additionally move the dialog window and beneath this I can see another equivalent dialog window. When I press ok or cancel I get this traceback:

Traceback (most recent call last):
   File "C:\Python24\Lib\site-packages\wx-2.6-msw-ansi\wx\lib\buttons.py", line 534, in OnLeftUp
     self.ReleaseMouse()
   File "C:\Python24\Lib\site-packages\wx-2.6-msw-ansi\wx\_core.py", line 9278, in ReleaseMouse
     return _core_.Window_ReleaseMouse(*args, **kwargs)
wx._core.PyAssertionError: C++ assertion "GetCapture() == this" failed in ..\..\src\common\wincmn.cpp(2439): attempt to release mouse, but this window hasn't captured it

I have also tested with other types of dialogs with the same result.

/Ragnar Ouchterlony

PS. Please CC me as I'm not on the list.

test.py (653 Bytes)

I forgot to add that I have tested this on wxPython 2.6.1.0 and 2.6.2.1 in an win32-ansi-py2.4 environment.

/Ragnar Ouchterlony

Ragnar Ouchterlony wrote:

There seem to be a bug in wx.lib.buttons.GenToggleButton. When you try to open a dialog in modal mode in an event caused by a toggle-button, the dialog doesn't receive input properly. See the attached example of the problem, test.py.

How I do to trigger it (using the example program):

Click the toggle me!-button, now I can write in the text control, but not click on "Ok" or "Cancel". Next I get focus to another window (which is not this program) and again focus the test program, now I can click on ok or cancel. Now I can additionally move the dialog window and beneath this I can see another equivalent dialog window. When I press ok or cancel I get this traceback:

Traceback (most recent call last):
  File "C:\Python24\Lib\site-packages\wx-2.6-msw-ansi\wx\lib\buttons.py", line 534, in OnLeftUp
    self.ReleaseMouse()
  File "C:\Python24\Lib\site-packages\wx-2.6-msw-ansi\wx\_core.py", line 9278, in ReleaseMouse
    return _core_.Window_ReleaseMouse(*args, **kwargs)
wx._core.PyAssertionError: C++ assertion "GetCapture() == this" failed in ..\..\src\common\wincmn.cpp(2439): attempt to release mouse, but this window hasn't captured it

I borrowed a time machine and this was fixed a few weeks ago. :wink: You can get a new copy of buttons.py from CVS at http://cvs.wxwidgets.org/viewcvs.cgi/wxWidgets/wxPython/wx/lib/buttons.py

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!