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/colored-title-and-label.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100755 examples/progress-bar/colored-title-and-label.py (limited to 'examples/progress-bar/colored-title-and-label.py') diff --git a/examples/progress-bar/colored-title-and-label.py b/examples/progress-bar/colored-title-and-label.py new file mode 100755 index 0000000..0b5e73a --- /dev/null +++ b/examples/progress-bar/colored-title-and-label.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python +""" +A progress bar that displays a formatted title above the progress bar and has a +colored label. +""" +import time + +from prompt_toolkit.formatted_text import HTML +from prompt_toolkit.shortcuts import ProgressBar + + +def main(): + title = HTML('Downloading ') + label = HTML("some file: ") + + with ProgressBar(title=title) as pb: + for i in pb(range(800), label=label): + time.sleep(0.01) + + +if __name__ == "__main__": + main() -- cgit v1.2.3