Getting cursor position with in Maya with Python/API?

I’m trying to make a painter script that uses raycasting and I’m wondering if there’s a way to query for the cursor position in Maya using python or the API. I’m aware of using the draggerContext to get the mouse position but I’m looking for a more general way to get the mouse position so I could use it with artUserPaintCtx. Is there a way to do this or am I SOL?

Sorry to bring up an old thread, but woah. :slight_smile: What you were doing seems really interesing. You wouldn’t happen to still be around, and if so, how’d it go?

Are you using MPxContext or a child of it? Or, if you have an MEvent object somewhere…

Implementing the doPress() method for example, you can then call:
short x, y;
event.getPosition( x, y );