unable to use Qt.OpenHandCursor attribute to set cursor shape

594 Views Asked by At

I have a python project that do the following import

from PyQt4 import QtGui, QtCore

I would like to change the cursor's shape at certain point, for example, I would create a new QCursor object

self.cursor_oh = QCursor()
self.cursor_oh.setShape()

most documentation and searches I did indicate to just set the shape using enum type such as:

Qt.OpenHandCursor

But, such enum is not recognized and it always results in the following error message:

AttributeError: 'module' object has no attribute 'OpenHandCursor'

So, what am I missing here?

2

There are 2 best solutions below

0
For Comment On BEST ANSWER

Apparently, the Qt namespace is under QtCore, so by adding the QtCore qualifier, it found all of the Qt cursor types.

0
asynts On

I haven't tried this in PyQt4 but in PyQt6 it has to be:

QtCore.Qt.CursorShape.OpenHandCursor