2010
10.15

Sometimes when UI events are posted right before entering a long section of a script, the Maya UI event wont occur until AFTER the section of code is complete. This problem is most obvious with the progressBar command, and the MFeedbackLine when used from python.

Here’s how to force Maya to go ahead and process UI events before continuing on with your script:

With processEvents:

import time
import maya.OpenMayaUI as apiUI
import maya.cmds as cmds

from PyQt4 import QtGui

apiUI.MFeedbackLine.setTitle('Waiting for 5 seconds')

#Get the QApplication instance, and process events
QtGui.qApp.processEvents()
time.sleep(5)
apiUI.MFeedbackLine.clear()

Without processEvents:

import time
import maya.OpenMayaUI as apiUI
import maya.cmds as cmds

apiUI.MFeedbackLine.setTitle('Waiting for 5 seconds')
time.sleep(5)
apiUI.MFeedbackLine.clear()

You must be logged in to post a comment.