[wxPython-users] PyPlot in MDI frames or sizer
Andriy
basilisk96 at gmail.com
Tue Aug 21 16:48:46 PDT 2007
> ---------- Forwarded message ----------
> From: Daniel Grolimund <daniel.grolimund at psi.ch>
> To: wxpython-users at lists.wxwidgets.org
> Date: Tue, 21 Aug 2007 17:22:08 +0200
> Subject: PyPlot in MDI frames or sizer
> **
>
> Hi everyone
>
> I am trying to use PyPlot to display updated time series of data (e.g.
> 'real-time' display of an ongoing measurement).
>
> In case I display the PyPlot in a single, main Frame, all semms to work
> (see attached ptest_s1.py).
>
>
> However, in case I try to do the same in a MDI frame, the series of
> PyPlot graphs is not displayed properly until the very last plot
> (see attached pmditest_s1.py).
> Similar behavior I observe by using a panel placed in a sizer.
>
> I would appreciate receiving any kind of help or advice.
>
>
> Thanks in advance
>
> Daniel Grolimund
>
Daniel,
Your main issue is that you are trying to draw before the app enters
MainLoop. The parent frame hangs with no hope of recovery until the
drawing completes, and the plot doesn't get a chance to completely
size itself to its parent until the end. What you should try instead
is this:
1. Take the drawing loop out of __ptest into a separate function.
2. Add a menu option to the parent frame to call this function.
I cheated by making winc1 a global name to access the child frame, but
there may be a better way to get the child frame ( I am not a MDI guru
:)
By doing that, your sample script will work just like the single-frame
example you posted, and without any need for sizers. The only issue
is that the app is unresponsive during the drawing loop. A wx.Yield()
at the bottom of the loop might help..
Cheers,
-amv-
More information about the wxpython-users
mailing list