I may be wrong, but I dont think there is a direct python equivalent of that 
example. But if you have that snippet, why not just compile it and use it as a 
command in your script? 
The python solutions I have seen are to use an MPxContext type approach and get 
the position from an event. 

All in all it seems you have a useable solution with that C++ snippet. 



On Mar 3, 2012, at 2:45 PM, wilsimar <[email protected]> wrote:

> Code from haluk cetiner on highend.
> 
> #include <maya/MSimple.h>
> #include <maya/MGlobal.h>
> #include <iostream>
> #include <fstream>
> 
> 
> using namespace std;
> 
> DeclareSimpleCommand(getcurPos, "ManualDesk", "8.0");
> 
> MStatus getcurPos::doIt( const MArgList& )
> {
> 
>         MStatus stat;WINSTA_READATTRIBUTES;
>         
>         LPPOINT lpoint=new tagPOINT;
> 
>         ::GetCursorPos(lpoint);
> 
>         clearResult();
> 
>         
>         appendToResult(lpoint->x);
>         appendToResult(lpoint->y);
> 
>     return MS::kSuccess;
> } 
> 
> Em sábado, 3 de março de 2012 19h43min56s UTC-3, wilsimar escreveu:
> my window is maya native widget ("window -title ..."), no qt. I want a way to 
> detect if esc key was pressed to quit my window, and before showwindow 
> command, send my window to mouse position.
> 
> I found this c++ api code for mouse screen position detection on highend 
> site, but trying convert it to python, DeclareSimpleCommand raising python 
> error (# Error: NameError: name 'DeclareSimpleCommand' is not defined # ).
> 
> thanks Justin
> -- 
> view archives: http://groups.google.com/group/python_inside_maya
> change your subscription settings: 
> http://groups.google.com/group/python_inside_maya/subscribe

-- 
view archives: http://groups.google.com/group/python_inside_maya
change your subscription settings: 
http://groups.google.com/group/python_inside_maya/subscribe

Reply via email to