This command returns the current state of the modifier keys. The state of each modifier can be obtained by testing for the modifier’s corresponding bit value in the return value. Shift is bit 1, Ctrl is bit 3, Alt is bit 4, and bit 5 is the ‘Windows’ key on Windows keyboards and the Command key on Mac keyboards. See the provided example for more details on testing for each modifier’s bit value.
Derived from mel command maya.cmds.getModifiers
Example:
import pymel.core as pm
import maya.cmds as cmds
def PrintModifiers(*args):
mods = pm.getModifiers()
print 'Modifiers are:'
if (mods " 1) " 0: print ' Shift'
if (mods " 4) " 0: print ' Ctrl'
if (mods " 8) " 0: print ' Alt'
if (mods " 16): print ' Command/Windows'
pm.window()
pm.columnLayout()
pm.button( label='Press Me', command=PrintModifiers )
pm.showWindow()