本文整理匯總了Python中progressbar.BouncingBar方法的典型用法代碼示例。如果您正苦於以下問題:Python progressbar.BouncingBar方法的具體用法?Python progressbar.BouncingBar怎麽用?Python progressbar.BouncingBar使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類progressbar
的用法示例。
在下文中一共展示了progressbar.BouncingBar方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: create_bar
# 需要導入模塊: import progressbar [as 別名]
# 或者: from progressbar import BouncingBar [as 別名]
def create_bar(self):
"""Create a new progress bar.
Calls `self.get_iter_per_epoch()`, selects an appropriate
set of widgets and creates a ProgressBar.
"""
iter_per_epoch = self.get_iter_per_epoch()
epochs_done = self.main_loop.log.status['epochs_done']
if iter_per_epoch is None:
widgets = ["Epoch {}, step ".format(epochs_done),
progressbar.Counter(), ' ',
progressbar.BouncingBar(), ' ',
progressbar.Timer()]
iter_per_epoch = progressbar.UnknownLength
else:
widgets = ["Epoch {}, step ".format(epochs_done),
progressbar.Counter(),
' (', progressbar.Percentage(), ') ',
progressbar.Bar(), ' ',
progressbar.Timer(), ' ', progressbar.ETA()]
return progressbar.ProgressBar(widgets=widgets,
max_value=iter_per_epoch)
示例2: processReplay
# 需要導入模塊: import progressbar [as 別名]
# 或者: from progressbar import BouncingBar [as 別名]
def processReplay(self, infile: Path):
widgets = [
progressbar.FormatLabel('Encoding MP4 '),
progressbar.BouncingBar(),
progressbar.FormatLabel(' Elapsed: %(elapsed)s'),
]
with progressbar.ProgressBar(widgets=widgets) as progress:
print(f"[*] Converting '{infile}' to MP4.")
outfile = self.prefix + infile.stem + '.mp4'
sink = Mp4EventHandler(outfile, progress=lambda: progress.update(0))
fd = open(infile, "rb")
replay = Replay(fd, handler=sink)
print(f"\n[+] Succesfully wrote '{outfile}'")
sink.cleanup()
fd.close()
示例3: _get_progressbar_widgets
# 需要導入模塊: import progressbar [as 別名]
# 或者: from progressbar import BouncingBar [as 別名]
def _get_progressbar_widgets(
sim_index: Optional[int], timescale: TimeValue, know_stop_time: bool
) -> List[progressbar.widgets.WidgetBase]:
widgets = []
if sim_index is not None:
widgets.append(f'Sim {sim_index:3}|')
magnitude, units = timescale
if magnitude == 1:
sim_time_format = f'%(value)6.0f {units}|'
else:
sim_time_format = f'{magnitude}x%(value)6.0f {units}|'
widgets.append(progressbar.FormatLabel(sim_time_format))
widgets.append(progressbar.Percentage())
if know_stop_time:
widgets.append(progressbar.Bar())
else:
widgets.append(progressbar.BouncingBar())
widgets.append(progressbar.ETA())
return widgets
示例4: show_deploy_progress_without_percentage
# 需要導入模塊: import progressbar [as 別名]
# 或者: from progressbar import BouncingBar [as 別名]
def show_deploy_progress_without_percentage(image_object, deployed_instance_id):
printer.out("Deployment in progress", printer.INFO)
status = image_object.api.Users(image_object.login).Deployments(Did=deployed_instance_id).Status.Getdeploystatus()
bar = ProgressBar(widgets=[BouncingBar()], maxval=UnknownLength)
bar.start()
i = 1
while not (status.message == "running" or status.message == "on-fire"):
status = image_object.api.Users(image_object.login).Deployments(Did=deployed_instance_id).Status.Getdeploystatus()
time.sleep(1)
bar.update(i)
i += 2
bar.finish()
return status
示例5: __call__
# 需要導入模塊: import progressbar [as 別名]
# 或者: from progressbar import BouncingBar [as 別名]
def __call__(self, count, blocksize, totalsize):
# In case we don't know the size of the file. zget < 0.9 did not
# report file sizes via HTTP.
if totalsize <= 0:
if self.pbar is None:
self.pbar = progressbar.ProgressBar(
widgets=[
self.filename,
' ',
progressbar.BouncingBar(),
' ',
progressbar.FileTransferSpeed(),
],
maxval=progressbar.UnknownLength
)
self.pbar.start()
# Make sure we have at least 1, otherwise the bar does not show
# 100% for small transfers
self.pbar.update(max(count * blocksize, 1))
# zget >= 0.9 does report file sizes and enables percentage and ETA
# display.
else:
if self.pbar is None:
self.pbar = progressbar.ProgressBar(
widgets=[
self.filename,
' ',
progressbar.Percentage(),
' ',
progressbar.Bar(),
' ',
progressbar.ETA(),
' ',
progressbar.FileTransferSpeed(),
],
# Make sure we have at least 1, otherwise the bar does
# not show 100% for small transfers
maxval=max(totalsize, 1)
)
self.pbar.start()
# Make sure we have at least 1, otherwise the bar does not show
# 100% for small transfers
self.pbar.update(max(min(count * blocksize, totalsize), 1))