def load_with_status(entry, callback):
prog_win = Toplevel(top, padx=8, pady=8)
prog_win.title = "Loading..."
prog_win.transient(top)
prog_win.resizable(FALSE, FALSE)
prog_bar = ttk.Progressbar(
prog_win, orient=HORIZONTAL, length=300, mode="indeterminate")
prog_bar.pack()
data = b""
try:
for i in fetch_data(entry[2], entry[3], int(entry[4])):
data += i
prog_bar.step()
callback(entry2url(entry), data)
except Exception as e:
showerror(
parent=top,
title="Error loading content",
message=str(e))
finally:
prog_win.destroy()
评论列表
文章目录