On Mon, Feb 15, 2010 at 6:50 AM, Michiel de Hoon <mjldeh...@yahoo.com> wrote:
> I almost have a solution for this for the Mac OS X backend. I am stuck though 
> at what I should pass to enter_notify_event and leave_notify_event for the 
> guiEvent:
>
>    def leave_notify_event(self, guiEvent=None):
>        """
>        Backend derived classes should call this function when leaving
>        canvas
>
>        *guiEvent*
>            the native UI event that generated the mpl event
>
>        """
>
> What are the requirements for guiEvent? If I call leave_notify_event without 
> guiEvent, so guiEvent = None, then the example gives me the following error:

we don't make any assumptions about what kind of object the gui event
is.  We provide the GUI event because sometimes when using a specific
backend, the user wants to drill into the GUI native event (eg a
button press event) but we don't use it anywhere in the mpl frontend
because this would break the abstraction.  So if you have some event
that is being fired at the UI level on figure enter, pass that in.

It looks like you may be having a problem because the
leave_notify_event is getting called more than once, or is called for
a figure that has not been entered.  Check the logic in
backend_bases.FigureCanvasBase.leave_notify_event


    def leave_notify_event(self, guiEvent=None):
        """
        Backend derived classes should call this function when leaving
        canvas

        *guiEvent*
            the native UI event that generated the mpl event

        """
        self.callbacks.process('figure_leave_event', LocationEvent.lastevent)
        LocationEvent.lastevent = None


It looks like your figure_leave_event is being triggered with
LocationEvent.lastevent = None (so it is not a problem with your
guiEvent).  This could happen if a leave event was processed *before*
and enter event (which sets the lastevent), or if a leave event was
processed twice.

Hopefully this will help you drill down into the source of the problem

JDH

------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to