i am trying to make youtube downloader and make Progressbar i want display progressbar while the video downloading and finish at the same time with video
Thomas <[email protected]> Fri, 2 Jul 2021 17:58:17 -0700 (PDT)
| Newsgroups | gmane.comp.python.wxpython |
|---|---|
| Message-ID | <[email protected]> |
I am new user in python and WX
I made an application so I can download videos from YouTube
I made a progress bar, but the problem is that the progress bar ends before
the video finishes from the download
I want to end the download bar with video download end
class Tube(wx.Frame):
def __init__(self*, **args*, ***kwargs):
super(Tube*, *self*, **args*, ***kwargs).__init__(parent=None*,*id
=wx.ID_ANY*, *title="New Frame"*, *size=(*600**, **400*))
self.Centre()
self.panel = wx.Panel(self*, *id=wx.ID_ANY*, *name="New Panel")
self.textLink = wx.StaticText(parent=self.panel*, *id=wx.ID_ANY*, *
label="Edit YouTube URL"*, *pos=(*100**, **50*))
self.editLink = wx.TextCtrl(parent=self.panel*, *id=wx.ID_ANY*, *
size=(*200**, **25*)*, *pos=(*250**,**50*))
self.downloadButton = wx.Button(parent=self.panel*, *id=wx.ID_ANY*,
*label="Download Video"*, *pos=(*250**, **100*))
self.downloadButton.Bind(event=wx.EVT_BUTTON*, *handler=self.thread*,
*source=self.downloadButton)
self.progress = wx.Gauge(parent=self.panel*, *id=wx.ID_ANY*, *range=
*100**,*size=(*200**,**25*)*, *pos=(*200**, **200*))
self.Show()
def progressBar(self*, **args*, ***kwargs):
for value in range(*101*):
wx.CallAfter(self.progress.SetValue*, *value)
sleep(*0.2*)
def Download(self*, **args*, ***kwargs):
self.video = YouTube(self.editLink.GetValue())
self.stream = self.video.streams.get_lowest_resolution()
self.stream.download()
def thread(self*, **args*, ***kwargs):
self.threads = []
self.thread1 = Thread(target=self.Download)
self.thread2 = Thread(target=self.progressBar)
self.threads.append(self.thread1)
self.threads.append(self.thread2)
for thread in self.threads:
thread.setDaemon(True)
thread.start()
if __name__ == '__main__':
app = wx.App()
screen = Tube()
app.MainLoop()
--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/wxpython-users/78512806-0bb5-4868-bff6-b9dfb582530bn%40googlegroups.com.