mirror of
https://github.com/verigak/progress.git
synced 2025-12-09 11:45:36 +00:00
Add PixelBar, based on braille characters
This commit is contained in:
@@ -12,13 +12,14 @@ Easy progress reporting for Python
|
|||||||
Bars
|
Bars
|
||||||
----
|
----
|
||||||
|
|
||||||
There are 6 progress bars to choose from:
|
There are 7 progress bars to choose from:
|
||||||
|
|
||||||
- ``Bar``
|
- ``Bar``
|
||||||
- ``ChargingBar``
|
- ``ChargingBar``
|
||||||
- ``FillingSquaresBar``
|
- ``FillingSquaresBar``
|
||||||
- ``FillingCirclesBar``
|
- ``FillingCirclesBar``
|
||||||
- ``IncrementalBar``
|
- ``IncrementalBar``
|
||||||
|
- ``PixelBar``
|
||||||
- ``ShadyBar``
|
- ``ShadyBar``
|
||||||
|
|
||||||
To use them, just call ``next`` to advance and ``finish`` to finish:
|
To use them, just call ``next`` to advance and ``finish`` to finish:
|
||||||
|
|||||||
@@ -80,5 +80,9 @@ class IncrementalBar(Bar):
|
|||||||
self.writeln(line)
|
self.writeln(line)
|
||||||
|
|
||||||
|
|
||||||
|
class PixelBar(IncrementalBar):
|
||||||
|
phases = ('⡀', '⡄', '⡆', '⡇', '⣇', '⣧', '⣷', '⣿')
|
||||||
|
|
||||||
|
|
||||||
class ShadyBar(IncrementalBar):
|
class ShadyBar(IncrementalBar):
|
||||||
phases = (' ', '░', '▒', '▓', '█')
|
phases = (' ', '░', '▒', '▓', '█')
|
||||||
|
|||||||
@@ -6,7 +6,8 @@ import random
|
|||||||
import time
|
import time
|
||||||
|
|
||||||
from progress.bar import (Bar, ChargingBar, FillingSquaresBar,
|
from progress.bar import (Bar, ChargingBar, FillingSquaresBar,
|
||||||
FillingCirclesBar, IncrementalBar, ShadyBar)
|
FillingCirclesBar, IncrementalBar, PixelBar,
|
||||||
|
ShadyBar)
|
||||||
from progress.spinner import Spinner, PieSpinner, MoonSpinner, LineSpinner
|
from progress.spinner import Spinner, PieSpinner, MoonSpinner, LineSpinner
|
||||||
from progress.counter import Counter, Countdown, Stack, Pie
|
from progress.counter import Counter, Countdown, Stack, Pie
|
||||||
|
|
||||||
@@ -23,7 +24,7 @@ for bar_cls in (Bar, ChargingBar, FillingSquaresBar, FillingCirclesBar):
|
|||||||
for i in bar.iter(range(200)):
|
for i in bar.iter(range(200)):
|
||||||
sleep()
|
sleep()
|
||||||
|
|
||||||
for bar_cls in (IncrementalBar, ShadyBar):
|
for bar_cls in (IncrementalBar, PixelBar, ShadyBar):
|
||||||
suffix = '%(percent)d%% [%(elapsed_td)s / %(eta_td)s]'
|
suffix = '%(percent)d%% [%(elapsed_td)s / %(eta_td)s]'
|
||||||
bar = bar_cls(bar_cls.__name__, suffix=suffix)
|
bar = bar_cls(bar_cls.__name__, suffix=suffix)
|
||||||
for i in bar.iter(range(200)):
|
for i in bar.iter(range(200)):
|
||||||
|
|||||||
Reference in New Issue
Block a user