File tree Expand file tree Collapse file tree 2 files changed +16
-10
lines changed Expand file tree Collapse file tree 2 files changed +16
-10
lines changed Original file line number Diff line number Diff line change @@ -117,12 +117,18 @@ def progress(self, value):
117117 ), "Progress value must be a floating point value."
118118 if self ._progress_val > value :
119119 # uncolorize range from width*value+margin to width-margin
120- for _w in range (int (value * self ._width + 2 ), self ._width - 2 ):
120+ # from right to left
121+ _prev_pixel = max (2 , int (self ._width * self ._progress_val - 2 ))
122+ _new_pixel = max (int (self ._width * value - 2 ), 2 )
123+ for _w in range (_prev_pixel , _new_pixel - 1 , - 1 ):
124+ print ("w {}" .format (_w ))
121125 for _h in range (2 , self ._height - 2 ):
122126 self ._bitmap [_w , _h ] = 0
123127 else :
124- # fully fill progress bar color
125- for _w in range (2 , self ._width * value - 2 ):
128+ # fill from the previous x pixel to the new x pixel
129+ _prev_pixel = max (2 , int (self ._width * self ._progress_val - 3 ))
130+ _new_pixel = min (int (self ._width * value - 2 ), int (self ._width * 1.0 - 3 ))
131+ for _w in range (_prev_pixel , _new_pixel + 1 ):
126132 for _h in range (2 , self ._height - 2 ):
127133 self ._bitmap [_w , _h ] = 2
128134 self ._progress_val = value
Original file line number Diff line number Diff line change 2727
2828current_progress = 0.0
2929while True :
30- while current_progress <= 1.0 :
31- print ("Progress: {}%" .format (current_progress * 100 ))
32- progress_bar .progress = current_progress
33- current_progress += 0.05
34- if current_progress >= 1.0 :
35- current_progress = 0.0
36- time .sleep (0.01 )
30+ for current_progress in range ( 0 , 21 ) :
31+ print ("Progress: {}%" .format (current_progress * 0.05 ))
32+ progress_bar .progress = current_progress * 0.05
33+ time . sleep ( 0.02 )
34+ time . sleep ( 0.3 )
35+ progress_bar . progress = 0.0
36+ time .sleep (0.3 )
You can’t perform that action at this time.
0 commit comments