Showing a wait indicator
This helper provides developers with a simple class for adding a wait indicator to terminal output for long running code.
The Indicator class was first introduced in FalconPy v1.5.1.
Indicator types
| Indicator | Example |
|---|---|
| clock | |
| cylon | |
| kitt | |
| thinking | |
| moon |
Properties
This class provides the following properties.
| Property | Returns | Data Type | Mutable |
|---|---|---|---|
| indicator | Current indicator as a list | List of strings | No |
| position | Current position within the indicator list | Integer | Yes |
Adding a wait indicator
The default indicator is moon. This can be changed by providing the style keyword argument to the Indicator class when you create an instance of the class.
Code example
This example will show the default indicator, moon.
from time import sleep
from falconpy import Indicator
wait = Indicator()
for x in range(0, 30):
print(f" {wait}", end="\r")
sleep(.25)
This example will show the clock indicator.
from time import sleep
from falconpy import Indicator
wait = Indicator(style="clock")
for x in range(0, 30):
print(f" {wait}", end="\r")
sleep(.25)
An example of this functionality in use can also be found in the source code of the HTTP Event Collector sample, "What the HEC?".