C M wrote:
Hello,
Hi, as a stop-gap fix for an issue I am still trying to
resolve regarding posting matplotlib plots into an
AUINotebook on Ubuntu (see: AdultFriendFinder.co.uk),
how can I programatically create an EVT_LEAVE_WINDOW
event for the frame?
By the way, this is for use with Ubuntu 8.10.
I have not programatically created events before, and
though have found some posts to it, am still a bit unsure
as to the right way for this case (is there a good docs
section on it somewhere?)
For this case EVT_LEAVE_WINDOW is a MouseEvent so you need to make a
mouse
event. (see docs.wxwidgets.org, or the wxpython docs this information can
be
found in both with a simple search.).
event = wx.MouseEvent(wx.wxEVT_LEAVE_WINDOW)
wx.PostEvent(destination_window, event)
Thanks, Cody.
Unfortunately, this didn't do the trick as I'd hoped. What's odd is that
if the cursor actually leaves the frame, a mpl plot posts to the
AUINotebook.
Is it really not there or has it just not painted itself? Or is it
there but the window is too small to see anything and it is not resizing
to fit the notebook page until later?
It appears to be there in the form of a small grey square.
To answer these questions you can add in a WIT to your app and then use
the widget tree and PyShell that it provides to do some introspection of
your app while it is running and having this problem. See
http://wiki.wxpython.org/Widget_Inspection_Tool
Useful, thank you, but interestingly, I can't even use it in the midst of
this problem it seems. If I have it running and I get to the point of
"have to leave frame before plot is (fully) shown", and then I mouse
over to the WIT (given that I can move the cursor over it without leaving
either frame's boundary), I can't click on Refresh there to see whether
the plotpanel has been added or not. In fact, I can't take any action
vis-a-vis wxPython--like closing the frames--unless I first leave the
frame.
Also, I've noticed that if I leave the frame BEFORE I attempt to post
a plot, then that plot posts OK. So it either posts if I have already
left the frame prior to or following attempting to post my plot.
Probably the best thing to do at this point would be to try and
duplicate the problem and then closely examine what you did to make it
fail.
I am trying. I have already tried posting a mpl plot with 250,000 pts,
thinking maybe it was a larger graph that was the problem, but that
worked. There are sqlite queries involved here, too, suspect that
might be part of it somehow. I will keep at it, but it just seems very
mysterious for now. By the way, I don't think my idle events have
anything to do with this, since I am not using the "size on idle"
strategy that the other person referred to, nor doing anything in idle.
I am also not using any wx.Yield.
Thanks, Robin.
Che
···
On Wed, Mar 18, 2009 at 7:23 PM, Robin Dunn <robin@alldunn.com> wrote:
2009/3/18 Cody Precord <codyprecord@gmail.com>:
On Wed, Mar 18, 2009 at 10:53 AM, C M <cmpython@gmail.com> wrote: