pymel.core.windows.hotkey

hotkey(*args, **kwargs)

This command sets the single-key hotkeys for the entire application. In query mode, return type is based on queried flag.

Flags:
Long name (short name) Argument Types Properties
altModifier (alt) bool ../../../_images/create.gif ../../../_images/query.gif
   
autoSave (autoSave) bool ../../../_images/create.gif
 
If set to true then the hotkeys will always be saved when you quit. If false then the hotkeys are not saved unless savePrefs -hotkeysis used.
commandModifier (cmd) bool ../../../_images/create.gif
 

The Command key must be pressed to get the hotkey. This is only available on systems which have a separate command key. Note that if menu item accelerator keys are being used (menuItem -ke/keyEquivalent), then the accelerator key settings override the hotkey settings.

ctrlModifier (ctl) bool ../../../_images/create.gif ../../../_images/query.gif
 

The Ctrl key must be pressed to get the hotkey. Note that if menu item accelerator keys are being used (menuItem -ke/keyEquivalent), then the accelerator key settings override the hotkey settings.

factorySettings (fs) bool ../../../_images/create.gif
 
Resets the hotkeys back to the initial defaults.
isModifier (mod) bool ../../../_images/create.gif
 
The hotkey is a modifier itself.
keyShortcut (k) unicode ../../../_images/create.gif
 

Specify what key is being set. The key must be either a single ascii character (capital and lowercase can be set independently) or one of the keyword strings for the specialkeyboard characters. The valid keywords are:Up, Down, Right, Left,Home, End, Page_Up, Page_Down, InsertReturn, SpaceF1 to F12

name (n) unicode ../../../_images/create.gif ../../../_images/query.gif
 
The name of the namedCommand object that will be executed when the key is pressed.
pressCommandRepeat (pcr) bool ../../../_images/create.gif
 
Specify true and the command may be repeated by executing the command repeatLast. This flag is false by default.
releaseCommandRepeat (rcr) bool ../../../_images/create.gif
 

Specify true and the command may be repeated by executing the command repeatLast. This flag is false by default. Flag can have multiple arguments, passed either as a tuple or a list.

releaseName (rn) unicode ../../../_images/create.gif ../../../_images/query.gif
 
The name of the namedCommand object that will be executed when the key is released.
sourceUserHotkeys (suh) bool ../../../_images/create.gif
 
This command reads the userHotkey file

Derived from mel command maya.cmds.hotkey

Example:

import pymel.core as pm

# Here's an example of how to create a namedCommand
# object and then map it to a key.
#
pm.nameCommand( 'circleToolNamedCommand', annotation='Select Circle Tool', command='setToolTo circleContext')
# Result: u'circleToolNamedCommand' #
pm.hotkey( k='F5', alt=True, name='circleToolNamedCommand' )


# Here are more examples of how to use the hotkey command.
#
pm.hotkey( k='d', name='Delete_Command' )
pm.hotkey( k='d', name='' ) # unsets the above command

pm.hotkey( k='d', name='Delete_Command' )
pm.hotkey( k='d', releaseName='After_Delete_Command' )
pm.hotkey( k='d', name='' ) #only unsets the key press name
pm.hotkey( k='d', releaseName='' ) #only unsets the key release name
pm.hotkey( k='d', n='', rn='' ) #unsets both the key press and release name

#    Determine if a command is attached to either the press or release
#    of the "z" hotkey.
#
pm.hotkey( 'z', query=True )
# Result: True #

#    Likewise, for the modified variations of the "z" key.
#
pm.hotkey( 'z', query=True, alt=True )
# Result: False #
pm.hotkey( 'z', query=True, ctl=True )
# Result: True #
pm.hotkey( 'z', query=True, alt=True, ctl=True )
# Result: False #

#    Determine the press command attached to the "z" key.
#
pm.hotkey( 'z', query=True, name=True )
# Result: u'NameComUndo' #

#    To query the "-" hotkey use the string "Dash" instead.
#
pm.hotkey( 'Dash', query=True )
# Result: True #

Previous topic

pymel.core.windows.hotBox

Next topic

pymel.core.windows.hotkeyCheck

Core

Core Modules

Other Modules

This Page