From 4f1a3b5f9ad05aa7b08715d48909a2b06ee2fcb1 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Mon, 15 Apr 2024 18:35:31 +0200 Subject: Adding upstream version 3.0.43. Signed-off-by: Daniel Baumann --- examples/progress-bar/nested-progress-bars.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100755 examples/progress-bar/nested-progress-bars.py (limited to 'examples/progress-bar/nested-progress-bars.py') diff --git a/examples/progress-bar/nested-progress-bars.py b/examples/progress-bar/nested-progress-bars.py new file mode 100755 index 0000000..1a1e706 --- /dev/null +++ b/examples/progress-bar/nested-progress-bars.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python +""" +Example of nested progress bars. +""" +import time + +from prompt_toolkit import HTML +from prompt_toolkit.shortcuts import ProgressBar + + +def main(): + with ProgressBar( + title=HTML('Nested progress bars'), + bottom_toolbar=HTML(" [Control-L] clear [Control-C] abort"), + ) as pb: + for i in pb(range(6), label="Main task"): + for j in pb(range(200), label=f"Subtask <{i + 1}>", remove_when_done=True): + time.sleep(0.01) + + +if __name__ == "__main__": + main() -- cgit v1.2.3