Skip to content
Advertisement

How can I change the cursor shape with PyQt?

I have a simple application that runs a process that can last for several minutes before completing. I am trying to provide an indication to the user that it is processing the request – such as changing the cursor to an hourglass.

But I cannot quite get it to work right. All of my attempts have resulted in either an error or had no effect. And I seem to be calling the cursor shapes incorrectly, since PyQt4.Qt.WaitCursor returns an error that the module does not contain it.

What is the correct way to indicate to the user that the process is running?

Advertisement

Answer

I think QApplication.setOverrideCursor is what you’re looking for:

PyQt5:

JavaScript

PyQt4:

JavaScript
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement