mouse event?

149 views
Skip to first unread message

max1

unread,
Nov 24, 2014, 3:10:50 AM11/24/14
to python_in...@googlegroups.com
hi...
i want,when releasing a mouse button,maya run a function...
please help me! thank :)

Justin Israel

unread,
Nov 24, 2014, 5:04:21 AM11/24/14
to python_in...@googlegroups.com
That's a bit of a generic question. It sounds like you want complete and unconditional control over any mouse click to run your function? If that is what you want, you should search the history on this list because the topic about installing event filters through Qt has been discussed.
Maybe you want something more specific, but your question isn't clear.

--
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_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/afac3007-732f-4f8d-b013-eca402dde8bc%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

max1

unread,
Nov 25, 2014, 6:42:22 PM11/25/14
to python_in...@googlegroups.com
#example:
cmds.window()
cmds.columnLayout()
cmds.button()
cmds.popupMenu( button=1,postMenuCommand='win()' )
cmds.showWindow()

def win():
    cmds.window('hi2')
    cmds.columnLayout()
    cmds.showWindow()
i am running example script now.i want...when releasing the mouse button,maya runing deleteUI('hi') command....
please help me...thanks!

Justin Israel

unread,
Nov 27, 2014, 1:14:21 AM11/27/14
to python_in...@googlegroups.com
The Maya native UI doesn't really give you fine grained controls over mouse down and up, but are you trying to do something like this?
from maya import utils 

cmds.window('hi')
cmds.columnLayout()
cmds.button("Button 1")
cmds.popupMenu( button=1,postMenuCommand=win)
cmds.showWindow()

def win(*args):
    utils.executeDeferred(deleteMain)
    cmds.window('hi2')
    cmds.columnLayout()
    cmds.button("Button 2")
    cmds.showWindow()

def deleteMain():
    cmds.deleteUI('hi')
It deletes the first window when you click the button and it opens the second window.


--
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_m...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages