def __init__(self):
super().__init__()
self.label = Label()
# Got messes with sys.stdout and sys.stderr in ways that confuse progressbar and cause it to output on the wrong one
# This can be worked around by passing in a new stream, but that stream can't be the same instance as sys.stdout or sys.stderr, so I make a new one here that forwards everything
class StreamWrapper:
def __getattr__(self, k):
return getattr(sys.stdout, k)
self.bar = progressbar.ProgressBar(fd = StreamWrapper(), widgets = [self.label, ' ', progressbar.Bar(), ' ', progressbar.Percentage(), ' '])
评论列表
文章目录