1

When a plot is updated with the set_data and draw method, the mouse cursor change few milliseconds from an arrow to a circle. Is it possible to avoid this? Because I update my plot 10 times per second so it is very ugly to see my mouse cursor change so quickly.

I am using Python 3.6, PyQt5, and matplotlib 2.1. Thank you in advance ;)

2 Answers 2

2

I found a solution : use QApplication.restoreOverrideCursor() when I leave the axe and QApplication.setOverrideCursor(QCursor(Qt.ArrowCursor)) when I enter in it. Something like this so:

self.figure.canvas.mpl_connect("axes_enter_event", self.figureEntree)
self.figure.canvas.mpl_connect("axes_leave_event", self.figureSortie)
def figureSortie(self, event):
   QApplication.restoreOverrideCursor()
def figureEntree(self, event):
   QApplication.setOverrideCursor(QCursor(Qt.ArrowCursor))

And it is possible to adapt the figureEntree function if you have a toolbar (change the cursor along the tool active => variables which change when you select a tool).

Sign up to request clarification or add additional context in comments.

1 Comment

For those looking for the full comand: QtGui.QGuiApplication.setOverrideCursor(QtGui.QCursor(QtCore.Qt.ArrowCursor)) . Using other cursors such as "QtCore.Qt.CrossCursor" is also possible.
1

This is a new "feature" of matplotlib 2.1.

The what's new page says

Busy Cursor

The interactive GUI backends will now change the cursor to busy when Matplotlib is rendering the canvas.

There is also this issue about the undesired behaviour.

5 Comments

It seems the above is not true for "TkAgg" backend, so using "TK" may be an option.
I have not the time to change the library for my plots so I have to live with this new feature even if I think, if it was not implemented before, there is a way to desactivate the busy cursor. Thank you for this information.
I will see if I find a solution later on.
I found a solution : use QApplication.restoreOverrideCursor() when I leave the axe (event axes_leave_event), and QApplication.setOverrideCursor(QCursor(Qt.ArrowCursor)) when I enter (event axes_enter_event)
Great. Just provide that as an answer yourself.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.