Python Reference Guide
 
Loading...
Searching...
No Matches
UI\FBProgress.py
1# Copyright 2009 Autodesk, Inc. All rights reserved.
2# Use of this software is subject to the terms of the Autodesk license agreement
3# provided at the time of installation or download, or which otherwise accompanies
4# this software in either electronic or hard copy form.
5#
6# Topic: FBProgress, FBSleep
7#
8
9from pyfbsdk import FBProgress, FBSleep
10
11# Create a FBProgress object and set default values for the caption and text.
12lFbp = FBProgress()
13
14# Call ProgressBegin() before use any other function and property.
15lFbp.ProgressBegin()
16
17# Set the custom task name.
18lFbp.Caption = "My Task"
19
20# Now simulate work being done. Sleep 20 ms at each iteration.
21for lVal in range(100):
22 # Stop the progress if user request cancellation by pressing and holding "ESC" key
23 if (lFbp.UserRequestCancell()):
24 break;
25
26 # Change sub description of the task.
27 if (lVal < 50) :
28 lFbp.Text = "Processing First Part ..."
29 else:
30 lFbp.Text = "Processing Second Part ..."
31
32 # Sleep 20 ms to simulate the task execution time.
33 FBSleep(20)
34 # Update progress percentage.
35 lFbp.Percent = lVal
36
37# We must call ProgressDone() to after progress is finished or cancelled.
38# to reset the progress bar to normal status.
39lFbp.ProgressDone()
40
41# Cleanup.
42del( lFbp, lVal, FBProgress, FBSleep )
43
Progress bar.b>Property: Base property class.
Definition: pyfbsdk_generated.h:14666
FBSleep(kULong MilliSeconds)
Sleep function Puts system to sleep for specified time.