[PyKDE] Problem setting a cursor on widget

Phil Thompson phil at riverbankcomputing.co.uk
Fri Nov 11 18:58:14 GMT 2005


On Friday 11 November 2005 6:26 pm, Rajeev Joseph Sebastian wrote:
> Hi,
>
> How do I set a cursor for a particular widget ?
>
> I tried using widget.setCursor( QCursor.PointingHandCursor), but it throws
> an exception saying ...
>
>     self.objectLabel.setCursor(QCursor.PointingHandCursor)
> TypeError: argument 1 of QWidget.setCursor() has an invalid type
>
>
> Using the statement QCursor.PointingHandCursor in the Python console,
> returns an integer...
>
> >>> QCursor.PointingHandCursor
>
> 13

Which doesn't say anything about the type of QCursor.PointingHandCursor, only 
that it's string representation is '13'.

> Also, I could not find anything in the PyQt docs.

Use the Qt docs to find out what type setCursor() is expecting.

You are trying to use the cursor's "name" rather than the cursor itself (which 
is the same but with the first character lower case).

Phil




More information about the PyQt mailing list