pymel.core.system.getModifiers

static system.getModifiers(*args, **kwargs)

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, Caps Lock is bit 2, Ctrl is bit 3, and Alt is bit 4. 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

pm.window()
# Result: ui.Window('window1') #
pm.columnLayout()
# Result: ui.ColumnLayout('window1|columnLayout40') #
pm.button( label='Press Me', command='PrintModifiers' )
# Result: ui.Button('window1|columnLayout40|button37') #
pm.showWindow()

def PrintModifiers():
    mods = pm.getModifiers()
    print 'Modifiers are:'
    if (mods " 1) " 0: print ' Shift'
    if (mods " 2) " 0: print ' CapsLock'
    if (mods " 4) " 0: print ' Ctrl'
    if (mods " 8) " 0: print ' Alt'
    print '\n'

Previous topic

pymel.core.system.getInputDeviceRange

Next topic

pymel.core.system.getReferences

Core

Core Modules

Other Modules

This Page