from tkinter import *
from tkinter.ttk import *
import threading
import numpy as np
def bar():
#function to display progress
pass
with open('/home/user154/test.txt') as f:
total=f.read().split('\n')
root = Tk()
links = list(filter(None, total)) #16530 links
threads =[]
#creating chunks of length 10
chunks = [i.tolist() for i in np.array_split(links, 10) if i.size>0]
# Progress bar widget
progress = Progressbar(root, orient = HORIZONTAL,
length = len(links), mode = 'determinate')
#launching the threads
for lst in chunks:
threads.append(threading.Thread(target=download_image, args=(lst)))
for x in threads:
x.start()
for x in threads:
x.join()
mainloop()
Hello, How can I Update the progress bar based on threads completion. I.e I have 16530 image links which I am trying to download and want to create a Progressbar
which shows the progress of downloading.
The download_image
function is pretty long so I didn't include in question but basically it's requests
and write to file.