Change cursor

Hello,
I want to change the appearance of my cursor. For that I included this code :

def changeMouseCursor(self,cursorFile):
        winprops=WindowProperties()
        winprops.setCursorFilename
        (Filename.binaryFilename(cursorFile))
        base.win.requestProperties(winprops)

My cursorFile is an image with the .ico format. I work on Linux.

This code doesn’t work, my cursor doesn’t change ! It returns me this error :
BadMatch (invalid parameter attributes)
BadCursor (invalid Cursor parameter)

Does anybody say what is the problem ?

Did you see any other error messages to the console before that, for instance “Could not find cursor filename” or “Could not open cursor file” or “Could not read from cursor file” or so on?

David

Yes, before I had “Could not find cursor filename” or “X11 cursor couldn’t be loaded”.

Those messages are relevant. Which one did you have? “Could not find cursor filename” means you gave the wrong filename. “X11 cursor couldn’t be loaded” is a more general problem and suggests something is wrong with the cursor file itself. Note that not every .ico file can be loaded on Linux; in particular, we can’t load PNG-compressed .ico files.

David

Thanks for your response and sorry for my late.

I always have the problem with my cursor. I had this message : “Could not find the cursor file name” so I specified the absolute path and now the message returned is “: BadMatch (invalid parameter attributes)” and “BadCursor (invalid Cursor parameter)”.
I don’t understand why I should specify the absolute path because with my other images I don’t do it. And above all why this don’t work.

In the config.prc file I did this :
cursor-filename sablier.ico

Any idea ?

Thanks in advance

The filename must be given relative to your model-path, which is the same as your other model files. What folder is the .ico file in, is it one of the folders on your model-path?

It sounds like the .ico file isn’t compatible with Linux. Try a different .ico file, or open it and re-save it without compression.

David

Yes my .ico file is in a folder in my model-path.

I did it and I save my .ico file without compression …

Can you post your .ico file where I can try it too?

David

I posted my .ico file at this link : http://demo.ovh.com/fr/a08d972479d30f570288d7861fd3c8c2/

Thanks

Hmm, curiously, that file works fine for me. It displays like an XP-style hourglass.

What version of Linux are you running? Which Panda?

David

I tried this .ico file with an other .py file. It works ! I don’t understand what the problem is.