This seems like a weird issue (did best I could with subject line).
Before I post a sample app I was hoping this made some sense to
someone here by the description.
I have been doing things on winXP and am just trying to get things to
work on Ubuntu, and having this odd issue with something that works
fine on Windows.
Problem Platform: Ubuntu 8.10 (64 bit), wxPython 2.6.3.2, Python 2.5.
Working Platform: WinXP SP2, wxPython 2.8.7.1., Python 2.5
Action: Push a button to add a AUINotebook page which contains a
super simple matplotlib plot (embedded in wx).
Problem It can add 1-2 plots and then on about the third instead of adding a
plot it makes a small gray square and just hangs. The screen goes to
shades of gray. The oddest thing, though, is if I move the cursor to leave
the main frame’s boundary, the plot gets added the instant I do that.
This happens every time: if a plot hangs, just move the cursor outside
the frame and it will be added. I have tested this with just adding a blue
panel to the AUINotebook and it has no problem with that, just with
matplotlib plots.
Any clues as to what I should look for? What’s the significance of the
cursor leaving the frame that would cause the plot to “finish”? And why
did this work fine on WinXP? Again, I can get a sample app eventually,
but hoped somebody might say, “Ah, the old mpl/AUI/Ubuntu thing
again.” (not likely, I know, but thought I’d throw it out first).
If you are using the PlotPanel class from http://www.scipy.org/Matplotlib_figure_in_a_wx_panel, it doesn't
actually update the figure size in the EVT_SIZE handler. Instead, it
sets a flag which is then checked in an EVT_IDLE handler, which then
resizes the figure.
I've seen messages here before that suggest that idle events aren't sent
as often as you might expect on Linux. For example here:
Perhaps you could try inserting a call to wx.WakeUpIdle inside
PlotPanel._onSize?
Hope that helps,
Simon
···
-----Original Message-----
From: wxpython-users-bounces@lists.wxwidgets.org
[mailto:wxpython-users-bounces@lists.wxwidgets.org] On Behalf Of C M
Sent: 17 March 2009 05:26
To: wxPython-users@lists.wxwidgets.org
Subject: [wxpython-users] ubuntu adds mpl plot in AUINotebook
only onleaving frame
This seems like a weird issue (did best I could with subject line).
Before I post a sample app I was hoping this made some sense to
someone here by the description.
I have been doing things on winXP and am just trying to get things to
work on Ubuntu, and having this odd issue with something that works
fine on Windows.
Problem Platform: Ubuntu 8.10 (64 bit), wxPython 2.6.3.2, Python 2.5.
Working Platform: WinXP SP2, wxPython 2.8.7.1., Python 2.5
Action: Push a button to add a AUINotebook page which contains a
super simple matplotlib plot (embedded in wx).
Problem It can add 1-2 plots and then on about the third
instead of adding a
plot it makes a small gray square and just hangs. The screen goes to
shades of gray. The oddest thing, though, is if I move the
cursor to leave
the main frame's boundary, the plot gets added the instant I
do that.
This happens every time: if a plot hangs, just move the
cursor outside
the frame and it will be added. I have tested this with just
adding a blue
panel to the AUINotebook and it has no problem with that, just with
matplotlib plots.
Any clues as to what I should look for? What's the
significance of the
cursor leaving the frame that would cause the plot to
"finish"? And why
did this work fine on WinXP? Again, I can get a sample app
eventually,
but hoped somebody might say, "Ah, the old mpl/AUI/Ubuntu thing
again." (not likely, I know, but thought I'd throw it out first).
Hi Andrea. I tried these now and it didn’t work. Thanks, though.
I have had trouble reproducing the problem in a small sample app, and
I think I understand why–which might be a clue to what is happening.
If I plot a simple plot, it basically works. If I plot one with more data
and database work, then it only posts the plot once I move the cursor
out of the frame. As if one process hasn’t finished yet before another
one begins, thus I guess your suggestion for CallAfter or SafeYield?
Maybe I am just not putting them in the right place?
Does anyone know of any way to programatically send the same
event as what is sent when the cursor leaves the frame in Linux?
Because, at least as a first pass until I get this figured out, maybe
I could send that event and it should at least post the plots.
actually update the figure size in the EVT_SIZE handler. Instead, it
sets a flag which is then checked in an EVT_IDLE handler, which then
resizes the figure.
Thanks, Simon. I had started with that (newer version on that page) class,
and then modified a bit, using that was originally “settling” into the right size
and it looked awkward.
I’ve seen messages here before that suggest that idle events aren’t sent
as often as you might expect on Linux. For example here: