It's a little complicated, as you have to create a plugin to use any of the MPx* classes, which is a bit of a pain. If you don't have much experience writing plugins, check out http://download.autodesk.com/us/maya/2009help/index.html?url=Maya_API_introduction.htm,topicNumber=d0e633209 for a basic intro, or http://download.autodesk.com/us/maya/2009help/API/index.html for a basic python example. You can compare that to http://download.autodesk.com/us/maya/2009help/API/sine_node_8cpp-example.html to get a feel for translating between C++ and python, and then check out some of the C++ examples that use MPxContexts / MEvents, like http://download.autodesk.com/us/maya/2009help/API/component_scale_manip_8cpp-example.html
As a word of warning before you start that journey, though, it may not be possible to do what you want - my understanding of MPxContexts isn't the greatest, but I believe they're only active when a custom-made tool is in use. So if you want to somehow trigger custom code to run WHENEVER the user does certain mouse events, regardless of what tool they're using, I don't think that's possible. I'd love to hear I'm wrong - Ravi in this post - http://groups.google.com/group/python_inside_maya/browse_thread/thread/bb7bf1e0cde111b8/abf604cbde3bad36?lnk=gst&q=click#abf604cbde3bad36 - implies that it's possible to register for mouse move messages - but he may have just been referring to when a custom tool is active. - Paul --~--~---------~--~----~------------~-------~--~----~ http://groups.google.com/group/python_inside_maya -~----------~----~----~----~------~----~------~--~---
