Hi Justin , Thanks you so much , it's awesome to be help so soon .
update code here because I spell wrong in few lines: ''' import maya.cmds as mc mc.window() mc.columnLayout(adj = 1) mc.button('testButton') mc.showWindow() import maya.OpentMayaUI as mui from PySide2 import QtWidgets import shiboken2 prt = mui.MQtUtil.findControl('testButton') qwidget = shiboken2.wrapInstance(long(ptr) , QtWidgets.QWidget) qwidget.mapToGlobal(qwidget.pos()) ''' Best Regards , 在 2018年6月19日星期二 UTC+8上午10:18:08,Justin Israel写道: > > > > On Tue, Jun 19, 2018 at 2:12 PM Zhen Huang <qeej...@gmail.com > <javascript:>> wrote: > >> Hi , >> >> It's there a solution to get maya UI position in screen space . >> >> ''' UI >> import maya.cmds as mc >> mc.window() >> mc.columnLayout(adj = 1) >> mc.button('testButton') >> mc.shwWindow() >> >> ''' >> >> There is a discussion about the windows UI in screen space . >> http://discourse.techart.online/t/maya-screen-position-of-gui/3055/6 >> >> And I tried it for a button UI , it seems a local position under the >> layout : >> ''' >> import maya.OpentMayaUI as mui >> from PySide2 import QtWdigets >> import shiboken2 >> prt = mui.MQtUtil.findControl('testButton') >> qwidget = shiboken2.wrapInstance(long(ptr) , QtWidgets.QWdiget) >> print qwidget.x() >> print qwidget.y() >> ''' >> >> > You are almost there. The x()/y() are local coordinates relative to its > parent. You can get the position and map it to global (screen coordinates): > > qwidget.mapToGlobal(qwidget.pos()) > > > Justin > > > >> >> Thanks , >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Python Programming for Autodesk Maya" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to python_inside_maya+unsubscr...@googlegroups.com <javascript:>. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/python_inside_maya/9029d150-4e98-4f10-b91b-c0939a3efe11%40googlegroups.com >> >> <https://groups.google.com/d/msgid/python_inside_maya/9029d150-4e98-4f10-b91b-c0939a3efe11%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> For more options, visit https://groups.google.com/d/optout. >> > -- You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group. To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/bfc80ad0-daf5-431c-bd0f-2e2634c726d5%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.