# Copyright 2009 Autodesk, Inc. All rights reserved. # Use of this software is subject to the terms of the Autodesk license agreement # provided at the time of installation or download, or which otherwise accompanies # this software in either electronic or hard copy form. # # Topic: FBProgress, FBSleep # from pyfbsdk import FBProgress, FBSleep # Create a FBProgress object and set default values for the caption and text. lFbp = FBProgress() # Call ProgressBegin() before use any other function and property. lFbp.ProgressBegin() # Set the custom task name. lFbp.Caption = "My Task" # Now simulate work being done. Sleep 20 ms at each iteration. for lVal in range(100): # Stop the progress if user request cancellation by pressing and holding "ESC" key if (lFbp.UserRequestCancell()): break; # Change sub description of the task. if (lVal < 50) : lFbp.Text = "Processing First Part ..." else: lFbp.Text = "Processing Second Part ..." # Sleep 20 ms to simulate the task execution time. FBSleep(20) # Update progress percentage. lFbp.Percent = lVal # We must call ProgressDone() to after progress is finished or cancelled. # to reset the progress bar to normal status. lFbp.ProgressDone() # Cleanup. del( lFbp, lVal, FBProgress, FBSleep )