Change Cursor

im thinking from some times to how change the 2D aspect of the mouse. I look in manuals and into the prcfiledata module and find some instruction like
change_cursor or something like that but that dont work…
If somebody has an answer for my problem.

You need to create an .ico file and set it in your Config.prc like:

cursor-filename myFile.ico

Presently, this only works on Windows (not supported on Linux).



I wonder how the pointer is then implemented in linux? Using system pointer? However, would it be possible to disable the “visual” pointer and create one that follows the invisible pointer?
Just a thought :slight_smile:

Regards, Bigfoot29

Right, it is possible to modify the mouse cursor in Linux, we just haven’t written the code to do it yet.

It is also possible to hide the mouse cursor, and render geometry onscreen exactly where the mouse cursor would be. In fact, there is code in MouseWatcher to do exactly this. Unfortunately, this is usually less than satisfactory, because then the mouse movement is limited by your frame rate, and unless you are achieving a consistent 60 Hz (or 72 Hz or whatever your video sync rate is), the “virtual” mouse will appear to be painfully sluggish to the user.


The mouse .ico can be displayed perfectly, but is there a way to override the hotspot ? Is the default on the middle-left ? …strange.

Is it only possible to specify one custom system mouse cursor through Config.prc or is there a way to specify multiple (pointer, hand, timer, etc…) and switch between them in panda.

you can use as many custom cursors as you wish, you can store the filename in a list. It looks only support 64x64 pixels. Use it through WindowProperties request. I use several cursors to achieve animated cursor.

def changeMouseCursor(self,cursorFile):

cursorFile is the filename (string).

Just an update for anyone reading this thread: thanks to a patch someone provided, we now have custom cursor support on Linux. Supported formats are X11 cursors and Windows .ico and .cur files. … mments=all

It’s checked into CVS, will be in the next release of Panda3D (1.7.1).

Oh cool, can’t wait to try. :smiley:

the doc should be updated. remember the manual mentioned that custom cursors worked only in Windows


maybe im mistaken, i cant find it.

I remember it saying it too, but they may have already changed it when they switch version last year.

Is there a solution to change the cursor on Mac? (I mean, different than hidding the cursor and rendering an image in cursor coordinates).
I’m using Panda 1.7.2.


Hmm, I had thought there was, but I’m not seeing this code now. So maybe not, unless you’d like to submit a patch for us. :wink:


Sadly, i don’t have the knowledge to do that.
Thanks anyway drwr!