I have been developing an application using PyQt ant Matplotlib and encountered
a problem with the mouse cursor shape being incorrect.  I found a work-around
that seems to work, but I think this is a bug and the fix needs to go into the
Matplotlib code base. Here are details.

My application has a central widget used fo r a Matplotlib Figure.
 Additionally there is a menu bar, button bar and two dock panels with
 controls for the plot.  I see the following behavior for the cursor:

* On start up, the cursor acts normally on startup provided
  the mouse cursor is not inside the figure widget on start-up.

* Mouse pointer shapes are set by Windows (in this case VISTA)
  and change shape according to location.  For example, touching
  the application window's border results in the arrow pointer
  changing shape to a double-headed arrow indicating the border
  can be dragged to adjust the size of the window.

* Once the mouse pointer touches the Matplotlib figure widget
  in any way, the mouse pointer will cease to show the double-arrow
  shape on the window borders - the pointer remains an arrowhead.
  You can still resize the window and the cursor does change to
  a double-arrow when you press the left button.

My workaround for this was to add the following lines of code in my
application:

        def onleave(self):
           QtGui.QApplication.restoreOverrideCursor()

        self.fig.canvas.mpl_connect('figure_leave_event',  onleave)

I guessed these lines by studying the matplotlib code.  Probably they
need to go somewhere inside the Matplotlib class definitions.

I hope this helps developers to correct this problem.  My application
code is medium-large and I didn't try to build a smaller example.  The
mysterious 3-line workaround solves my problem for the moment.
Perhaps it will help another PyQt and Matplotlib user and perhaps
urge developers to fix the problem in the Matplotlib core.

David Smith

------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to