wxpython compatibility issues?

Hi,
Thanks for the suggestion Mike. However, that would not explain why it
freezes on windows but not on linux. I'm also not binding to any mouse
movements (just keyboard and button events) Just to be sure I
commented out all of the binding except EVT_BUTTON and EVT_MENU) and
it still freezes. What is more annoying is that I have a previous
version that actually works on windows also and I've pored over the
diff and I can't figure out what could have cause the change.

Elan

···

---
Fortunately, the second-to-last bug has just been fixed.
    -- Ray Simard

On Fri, May 8, 2009 at 4:18 AM, <wxpython-users-request@lists.wxwidgets.org> wrote:

Message: 5
Date: Thu, 7 May 2009 17:36:03 -0700
From: Mike Haimes <mike@getdropbox.com>
Subject: Re: [wxpython-users] wxpython compatibility issues?
To: wxpython-users@lists.wxwidgets.org
Message-ID:
<9dd56b750905071736j598336dfr52158b644b9e178b@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"

These are symptoms you would get from a program that never properly yields
control back to the main event loop from an event handler. If you can
reproduce it consistently, this usually makes it easy to track. Have you
bound any event handlers to window/mouse events? the first step is to double
check all of them and make sure they all return in a timely fashion.

-Mike

On Thu, May 7, 2009 at 5:26 PM, Ben Saylor <anbrs1@uaa.alaska.edu> wrote:

Elan Pavlov wrote:

Hi,
I'm using wxpython (with an embedded matplotlib plot) on several
platforms. On my linux box it behaves nicely however the exact same
code when run on a windows machine causes problems.
The main problem seems to be related to mouse events (I assume due to
the non-native support for them on windows). When clicking on a
title-bar or even when moving a mouse out of the main frame the system
freezes and shows a white screen (and gets the windows 'not
responding' title). This also happens when left-clicking but
(apparently not right-clicking) I've tried binding the mouse events
but this doesn't seem to help (perhaps since the freezing happens
before it reaches my function).
Has anyone had this problem before? Is there some kind of known
solution or does someone have a suggestion on what to do to?

Elan

I have had occasional freezing in Windows at seemingly random times. So
far, it seems that switching focus away from the window and back fixes it.
I would be interested in hearing suggestions on how to debug GUI freezes.
Maybe some kind of watchdog program that could write a stack trace to a =

log

file whenever a freeze is detected?

Ben

____

Elan Pavlov wrote:

Hi,
Thanks for the suggestion Mike. However, that would not explain why it
freezes on windows but not on linux. I'm also not binding to any mouse
movements (just keyboard and button events) Just to be sure I
commented out all of the binding except EVT_BUTTON and EVT_MENU) and
it still freezes. What is more annoying is that I have a previous
version that actually works on windows also and I've pored over the
diff and I can't figure out what could have cause the change.

If you are using Python 2.6 and wxPython < 2.8.10 (preview) then see the archives for a description of the problem and a workaround. Otherwise http://wiki.wxpython.org/MakingSampleApps

···

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

Hi,
I've managed to isolate the problem. It's an interplay between
wxpython, the threading module and windows. In my application I want
to run the GUI from a backend (which interacts with several
components) mainly for plotting information that the backend receives.
In order to make the API simple I've tried to limit the interaction to
a simple call to run the GUI which will then interact with the backend
automatically.
Hence the call to the GUI should create it's own thread in which it
can run the MainLoop.
On linux this works very nicely. However, on windows this results in a
frozen GUI. I attach a very simple example with a flag that controls
the type of threading behaviour.
Undoubtedly, I'm doing something wrong and I'd appreciate advice:)

Elan

wxpython-thread.py (2.4 KB)

···

---
All programmers are optimists. Perhaps this modern sorcery especially
attracts those who believe in happy endings and fairy godmothers.
Perhaps the hundreds of nitty frustrations drive away all but those
who habitually focus on the end goal. Perhaps it is merely that
computers are young, programmers are younger, and the young are always
optimists. But however the selective process works, the result is
indisputable: "This time it will surely run," or "I just found the
last bug."
    - Frederick Brooks

On Fri, May 8, 2009 at 10:12 AM, Elan Pavlov <epavlov@gmail.com> wrote:

Hi,
Thanks for the suggestion Mike. However, that would not explain why it
freezes on windows but not on linux. I'm also not binding to any mouse
movements (just keyboard and button events) Just to be sure I
commented out all of the binding except EVT_BUTTON and EVT_MENU) and
it still freezes. What is more annoying is that I have a previous
version that actually works on windows also and I've pored over the
diff and I can't figure out what could have cause the change.

Elan
---
Fortunately, the second-to-last bug has just been fixed.
-- Ray Simard

On Fri, May 8, 2009 at 4:18 AM, > <wxpython-users-request@lists.wxwidgets.org> wrote:

Message: 5
Date: Thu, 7 May 2009 17:36:03 -0700
From: Mike Haimes <mike@getdropbox.com>
Subject: Re: [wxpython-users] wxpython compatibility issues?
To: wxpython-users@lists.wxwidgets.org
Message-ID:
<9dd56b750905071736j598336dfr52158b644b9e178b@mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"

These are symptoms you would get from a program that never properly yields
control back to the main event loop from an event handler. If you can
reproduce it consistently, this usually makes it easy to track. Have you
bound any event handlers to window/mouse events? the first step is to double
check all of them and make sure they all return in a timely fashion.

-Mike

On Thu, May 7, 2009 at 5:26 PM, Ben Saylor <anbrs1@uaa.alaska.edu> wrote:

Elan Pavlov wrote:

Hi,
I'm using wxpython (with an embedded matplotlib plot) on several
platforms. On my linux box it behaves nicely however the exact same
code when run on a windows machine causes problems.
The main problem seems to be related to mouse events (I assume due to
the non-native support for them on windows). When clicking on a
title-bar or even when moving a mouse out of the main frame the system
freezes and shows a white screen (and gets the windows 'not
responding' title). This also happens when left-clicking but
(apparently not right-clicking) I've tried binding the mouse events
but this doesn't seem to help (perhaps since the freezing happens
before it reaches my function).
Has anyone had this problem before? Is there some kind of known
solution or does someone have a suggestion on what to do to?

Elan

I have had occasional freezing in Windows at seemingly random times. So
far, it seems that switching focus away from the window and back fixes it.
I would be interested in hearing suggestions on how to debug GUI freezes.
Maybe some kind of watchdog program that could write a stack trace to a =

log

file whenever a freeze is detected?

Ben

____

--
If I knew that a man was coming to my house with the conscious design
of doing me good, I should run for my life.
- Henry David Thoreau

Elan Pavlov wrote:

Hi,
I've managed to isolate the problem. It's an interplay between
wxpython, the threading module and windows. In my application I want
to run the GUI from a backend (which interacts with several
components) mainly for plotting information that the backend receives.
In order to make the API simple I've tried to limit the interaction to
a simple call to run the GUI which will then interact with the backend
automatically.
Hence the call to the GUI should create it's own thread in which it
can run the MainLoop.
On linux this works very nicely. However, on windows this results in a
frozen GUI. I attach a very simple example with a flag that controls
the type of threading behaviour.
Undoubtedly, I'm doing something wrong and I'd appreciate advice:)

1. wx can only run in the main thread.
2. Which ever is the active thread when the wx.App object is created is the main thread from wx's perspective.

So in other words, if you move the creation of the wx.App object in your example into the thread's run() method then it should work as expected.

···

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