1#!/usr/bin/env python 2""" 3A progress bar that displays a formatted title above the progress bar and has a 4colored label. 5""" 6from __future__ import unicode_literals 7 8import time 9 10from prompt_toolkit.formatted_text import HTML 11from prompt_toolkit.shortcuts import ProgressBar 12 13 14def main(): 15 title = HTML('Downloading <style bg="yellow" fg="black">4 files...</style>') 16 label = HTML('<ansired>some file</ansired>: ') 17 18 with ProgressBar(title=title) as pb: 19 for i in pb(range(800), label=label): 20 time.sleep(.01) 21 22 23if __name__ == '__main__': 24 main() 25