This provides a very simple progress bar for long running tasks.
The design is somewhat similar to EasyGUI, allowing simple scripts to be GUI-fied without being refactored into callbacks and an event loop. It can naturally be used as an addition to the tools in EasyGUI. The interface can’t be quite as simple, but hopefully it’s only a little more complex.
progress_meter is based on this code by Michael Lange.
The high-level interface looks like this:
from progress_meter import withprogress
@withprogress(300, color="green")
def demo(foo, bar=None):
for i in range(300):
# Do one (or a few) steps of processing, then...
yield i
demo()
You can use exceptions to see if the user cancelled the process before it completed:
try:
demo()
except UserCancelled:
print("Cancelled")
else:
print("Completed")
There’s also a lower-level interface in which you instantiate the window directly:
from progress_meter import MeterWindow
def _demostep(meter, value):
meter.set(value)
if value < 1.0:
value = value + 0.005
meter.after(50, lambda: _demostep(meter, value))
else:
meter.set(value, 'Demo successfully finished')
def demo():
root = MeterWindow(className='meter demo')
root.meter.set(0.0, 'Starting demo...')
root.after(1000, lambda: _demostep(root.meter, 0.0))
root.mainloop()
To use the progress bar alone in a more complete GUI, you can use the Meter class from this module (which subclasses tkinter.Frame).
Metadata
Release files for progress_meter 1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distributions (sdists)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| progress_meter-1.0.zip | 5.1 kB | Without provenance | Details for progress_meter-1.0.zip | |
| progress_meter-1.0.tar.gz | 4.3 kB | Without provenance | Details for progress_meter-1.0.tar.gz |
Release files / progress_meter-1.0.zip
| Download URL | progress_meter-1.0.zip |
|---|---|
| Size | 5.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8fed35da60b8654b66ebbe2aa3f9451ee42c888566bed40d713406276a2168b3
|
|
BLAKE2b-256 checksum How to use checksums |
dce40e9349f21c30b18cda25dc5286ea974b93e4271c625d08579a7776395667
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / progress_meter-1.0.tar.gz
| Download URL | progress_meter-1.0.tar.gz |
|---|---|
| Size | 4.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
eb9df411827950d35471f3aa1551f575ed5360213ec2c9a121d9ee2fe92eafdd
|
|
BLAKE2b-256 checksum How to use checksums |
90fd15cc7539f23791670339045cba90cd5915ebb0ad967d388e26abdf16000f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for progress_meter 1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.