wx/lib/buttons.py on windows 8, 64 bit

40 views
Skip to first unread message

Prashant

unread,
May 15, 2013, 2:23:05 AM5/15/13
to wxpytho...@googlegroups.com
Hi,

One of the user of my app reported this error:

Caption=Microsoft Windows 8 Pro
Version=6.2.9200
Build=9200
ProcessorCaption=Intel(R) Core(TM) i7-2600K CPU @ 3.40GHz
Processor=Intel64 Family 6 Model 42 Stepping 7, GenuineIntel
Architecture=64Bit
Wxpython=2.8.12.1 unicode

----- Details -----
Traceback (most recent call last):  File "core\wx\lib\buttons.pyo", line 335, in OnLeftUp
  File "wx\_core.pyo", line 9771, in Refresh
TypeError: in method 'Window_Refresh', expected argument 1 of type 'wxWindow

The line number may be different in standard wxpython file as I slightly modified buttons.py by adding few extra things but not in class.
The line is second last in the function "self.Refresh()".

This function resides in GenButton(wx.PyControl) class.

Although I never tested my app on windows 8 but I am sure this is related to win 8. So far app is working fine on linux, osx, xp and win 7.

Cheers

Prashant

Tim Roberts

unread,
May 15, 2013, 1:28:16 PM5/15/13
to wxpytho...@googlegroups.com
Prashant wrote:
>
> One of the user of my app reported this error:
> ...
> ----- Details -----
> Traceback (most recent call last): File "core\wx\lib\buttons.pyo",
> line 335, in OnLeftUp
> File "wx\_core.pyo", line 9771, in Refresh
> TypeError: in method 'Window_Refresh', expected argument 1 of type
> 'wxWindow
>
> The line number may be different in standard wxpython file as I
> slightly modified buttons.py by adding few extra things but not in class.
> The line is second last in the function "self.Refresh()".
>
> This function resides in GenButton(wx.PyControl) class.
>
> Although I never tested my app on windows 8 but I am sure this is
> related to win 8. So far app is working fine on linux, osx, xp and win 7.

You're going to need to gather more information in order to debug this.
Does it happen every time the button is clicked, or are there other
things required? Was it a click or a touch? This code is actually in
__ToggleMixin. Did you change that? Is the button closing the window?

The code at that point looks like this:
if self.HasCapture():
self.ReleaseMouse()
self.Refresh()

It's not clear to me how the type could have disappeared between the
ReleaseMouse call and the Refresh call.

--
Tim Roberts, ti...@probo.com
Providenza & Boekelheide, Inc.

Robin Dunn

unread,
May 15, 2013, 1:54:43 PM5/15/13
to wxpytho...@googlegroups.com
Tim Roberts wrote:
> Prashant wrote:
>> One of the user of my app reported this error:
>> ...
>> ----- Details -----
>> Traceback (most recent call last): File "core\wx\lib\buttons.pyo",
>> line 335, in OnLeftUp
>> File "wx\_core.pyo", line 9771, in Refresh
>> TypeError: in method 'Window_Refresh', expected argument 1 of type
>> 'wxWindow
>>
>> The line number may be different in standard wxpython file as I
>> slightly modified buttons.py by adding few extra things but not in class.
>> The line is second last in the function "self.Refresh()".
>>
>> This function resides in GenButton(wx.PyControl) class.
>>
>> Although I never tested my app on windows 8 but I am sure this is
>> related to win 8. So far app is working fine on linux, osx, xp and win 7.
>
> You're going to need to gather more information in order to debug this.
> Does it happen every time the button is clicked, or are there other
> things required? Was it a click or a touch?

Also, which version of wxPython is it? Is it happening only in a
py2exe'd version of the application or can it be made to happen in
normal scripting environment too?


> This code is actually in
> __ToggleMixin. Did you change that? Is the button closing the window?
>
> The code at that point looks like this:
> if self.HasCapture():
> self.ReleaseMouse()
> self.Refresh()
>
> It's not clear to me how the type could have disappeared between the
> ReleaseMouse call and the Refresh call.
>

There is also the OnLeftUp in the base class, which is closer to the
line number given. It looks like this:

def OnLeftUp(self, event):
if not self.IsEnabled() or not self.HasCapture():
return
if self.HasCapture():
self.ReleaseMouse()
if not self.up: # if the button was down when the mouse
was released...
self.Notify()
self.up = True
if self: # in case the button was destroyed in
the eventhandler
self.Refresh()
event.Skip()


So it's possible that something could happen in the event handler while
in self.Notify, however the "if self:" line should have caught the case
of the button widget being destroyed. OTOH, if the normal widget
destruction didn't happen but instead something happened to self.this,
then that could give an error like the above. The .this attribute is
how things like the instance pointer and the object's type info are tracked.


--
Robin Dunn
Software Craftsman
http://wxPython.org
Reply all
Reply to author
Forward
0 new messages