1#!/usr/bin/env python 2""" 3Styled just like an apt-get installation. 4""" 5from __future__ import unicode_literals 6 7import time 8 9from prompt_toolkit.shortcuts import ProgressBar 10from prompt_toolkit.shortcuts.progress_bar import formatters 11from prompt_toolkit.styles import Style 12 13style = Style.from_dict({ 14 'label': 'bg:#ffff00 #000000', 15 'percentage': 'bg:#ffff00 #000000', 16 'current': '#448844', 17 'bar': '', 18}) 19 20 21def main(): 22 custom_formatters = [ 23 formatters.Label(), 24 formatters.Text(': [', style='class:percentage'), 25 formatters.Percentage(), 26 formatters.Text(']', style='class:percentage'), 27 formatters.Text(' '), 28 formatters.Bar(sym_a='#', sym_b='#', sym_c='.'), 29 formatters.Text(' '), 30 ] 31 32 with ProgressBar(style=style, formatters=custom_formatters) as pb: 33 for i in pb(range(1600), label='Installing'): 34 time.sleep(.01) 35 36 37if __name__ == '__main__': 38 main() 39