Reset the default mouse cursor

I want to change the mouse cursor based on the user interaction. It works with this code :

self.defaultCursor = self.winprops.getCursorFilename()
self.winprops = WindowProperties()

def changeMouseCursor(self,cursorFile):

But how can I reset the default cursor when my specific action is end ?

I tried this without success :

def resetCursor(self):

An idea ?

I should think that setting an empty Filename() would restore the default cursor. Does that work?


Great ! It works !
However, the first time I have an alert message : “Access denied”. What it is ?
How can I avoid it ?

Thanks !

I don’t know. What do you mean by alert message, it pops up in a message dialog on top of the Panda window? I have no idea what could be causing that.


It seems that passing Filename() to setCursorFilename() results in Panda3D looking for a file that has the empty string as its name, since the error message in the console reads as follows:

:display:windisplay(warning): windows cursor filename 'C:\Projects\myproject' could not be loaded!!
:display:windisplay(fatal): System error msg: Access is denied.

where ‘C:\Projects\myproject’ is the current working directory and not a file, hence the error message.

(Windows 7, Panda3D 1.7.2)

Filename() creates a new Filename with the empty string as path. I’m not sure what you were expecting it to do otherwise.

It’s not that I expected anything else from Filename() than an empty path, but when passing that empty path to setCursorFilename(), I hoped that the following would work:

And it does, but only after the system error occurring. The error message in the console can be ignored, but the real problem is that it also pops up in a window (caption: “Panda3D Error”, message: “Access is denied.”), blocking the application.

Even though it only happens the first time setCursorFilename(Filename()) is called, it’s still annoying.

Hmm, seems like a minor bug. Could you post a bug report to the launchpad? Thanks!


Bug report posted.