Answer the question
In order to leave comments, you need to log in
tkinter. How to abort file upload in urllib on GUI close?
There is the following code:
# -*- coding: utf-8 -*-
from Tkinter import *
import urllib, ttk, tkMessageBox
from threading import Thread
def downloader():
urllib.urlretrieve('http://cs521111v4.vk.me/u176613573/audios/e168af8959c0.mp3', 'file.mp3')
th=Thread(target=downloader,args=())
def starter(event):
th.start()
pb.pack()
pb.start()
root= Tk()
pb = ttk.Progressbar(length = 200, orient = 'horizontal', mode = 'indeterminate')
but = Button(root, text = 'Go!')
root.minsize(width = 400, height = 350)
but.bind('<Button-1>', starter)
but.pack()
root.mainloop()
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question