I am trying to show a self-updated timer/progress bar when the system is reading the following file:
#initialize widgets
widgets = ['Reading data, please wait: ', pb.Percentage(), ' ',
pb.Bar(marker=pb.RotatingMarker()), ' ', pb.ETA()]
#initialize timer
timer = pb.ProgressBar(widgets=widgets, maxval=1000000).start()
for i in range(0,1000000):
timer.update(i)
pages = convert_from_path(filepath + "\" + file, poppler_path = r'C:UsersuserAppDataLocalProgramsPythonPython38PUGpoppler-0.67.0_x86poppler-0.67.0in')
timer.finish()
However, if I put the above code in for loop, the time will not update itself but until the file is finished reading.
Is there any way to print the progress and update the time, at the same time, the system is reading that large pdf file.
e.g. Reading file, please wait... Time escape: 1s<-- the time will update itself every second
after the system finished reading, the timer will no longer update.
Thx
question from:
https://stackoverflow.com/questions/65949870/python-a-progress-bar-or-self-updated-timer-when-reading-a-large-pdf-file-with-p 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…