pymel.core.general.evalDeferred

evalDeferred(*args, **kwargs)

This command takes the string it is given and evaluates it during the next available idle time. It is useful for attaching commands to controls that can change or delete the control.

Flags:

Long Name / Short Name Argument Types Properties
evaluateNext / en bool ../../../_images/create.gif
  Specified that the command to be executed should be ran with the highest priority, ideally queued up next.
list / ls bool ../../../_images/create.gif
  Return a list of the command strings that are currently pending on the idle queue. By default, it will return the list of commands for all priorities. The -lowestPriority and -lowPriority can be used to restrict the list of commands to a given priority level.
lowPriority / low bool ../../../_images/create.gif
  Specified that the command to be executed should be deferred with the low priority. That is, it will be executed whenever Maya is idle.
lowestPriority / lp bool ../../../_images/create.gif
  Specified that the command to be executed should be deferred with the lowest priority. That is, it will be executed when no other idle events are scheduled. Flag can have multiple arguments, passed either as a tuple or a list.

Derived from mel command maya.cmds.evalDeferred

Example:

import pymel.core as pm

pm.window()
# Result: ui.Window('window1') #
pm.columnLayout()
# Result: ui.ColumnLayout('window1|columnLayout27') #
button = pm.button(label='Delete Me')
pm.button(button, edit=True, command=('pm.evalDeferred("pm.deleteUI(button)")'))
# Result: ui.Button('window1|columnLayout27|button27') #
pm.showWindow()