Mouse pointer troubles

I’ve been trying to get my custom mouse pointer on the screen instead of the standard one, no luck though…
I’ve looked through the manual, api refference, but cant find a methode to replace it, does anyone know a good solution for this?

I haven’t actually tried this but WindowProperties has a setCursorFilename function:

winProps = base.win.getProperties()
winProps.setCursorFilename(<your filename here>)
base.win.requestProps(winProps)

Your filename (I would guess) is passed as a string, but more likely it is a Filename type(Look at pandac.Filename in the api reference). Like I said I haven’t tried it, but its a start.

Hmm, good idea but I cant get it to work with a string, neither .cur files or normal image files, neither the filenames tkinter uses to bring up the regular cursors (ie busy).

Perhaps I should just hide the mouse cursor and position a directlable on its spot… Seems messier though, I would have though there would be a function implemented to do this, since its pretty basic.

Thanks for the sugestion anyway!

What platform are you running on? On Windows, you can specify a .cur file. Monochrome .cur files work best over a 3-D window, but color usually works too (depending on your version of Windows). You should name the full path to the .cur file, or put the .cur file somewhere in your model-path.

On Linux, changing the mouse pointer is not yet supported. You can easily hide the mouse pointer and put a polygon where the mouse pointer is supposed to be (see base.mouseWatcherNode.setGeometry()), but this will tie the mouse pointer motion to your rendering frame rate, making the mouse move slowly when you are rendering a lot, which tends to be frustrating for the user.

David

So I tried it out and got it to work. You cannot use a string as the argument, you first have to make it a Filename. I was using Windows XP, and had the script and cursor filename in the same directory:

import direct.directbase.DirectStart
from pandac.Filename import Filename

winProps = base.win.getProperties()
fname = Filename("3DSMOVE.CUR")
winProps.setCursorFilename(fname)
base.win.requestProperties(winProps)

run()

When I said cursor filename, I meant the cursor file was in the same directory as the script I was running. You would have to specify the path when you create the Filename(). I also tried it with .jpg and that didnt work, so they have to be .cur files. Using ‘BossArm.jpg’ from Airblade gave me these errors:

:display:windisplay(warning): windows cursor filename ‘BossArm.jpg’ could not be loaded!!
:display:windisplay(fatal): System error msg: The operation completed successfully.

I thought the second one was a little ironic.

Wonderfull! This works like a charm :slight_smile:

drwr: Running on windows, so for linux I’d prolly have to code in the other solution.

russ: Thanks again, I didnt know there was a filename module ^^