Created
June 3, 2014 12:28
-
-
Save Michcioperz/68ce01fbb7dedf67f2da to your computer and use it in GitHub Desktop.
MichiTube - simple Tk wrapper over youtube-dl made for my noob schoolmates
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from tkinter import * | |
| from tkinter.ttk import * | |
| import subprocess, os | |
| class MichiDLFrame(Frame): | |
| def __init__(self, code, master=None): | |
| Frame.__init__(self, master) | |
| self.pack() | |
| self.excode = code | |
| self.createWidgets() | |
| def createWidgets(self): | |
| self.label = Label(self) | |
| if self.excode != 0: | |
| self.label["text"] = "Pobieranie nie zakonczylo sie pomydlnie. Nie wiem czemu, bo jeszcze slaby ze mnie program." | |
| else: | |
| self.label["text"] = "Plik zapisany w folderze %s." % os.getcwd() | |
| self.label.pack() | |
| class MichiTube(Frame): | |
| def __init__(self, master=None): | |
| Frame.__init__(self, master) | |
| self.masterer = master | |
| self.pack() | |
| self.status = StringVar() | |
| self.status.set("Pobierz") | |
| self.createWidgets() | |
| def createWidgets(self): | |
| self.entrylabel = Label(self, text="Tu wpisz adres") | |
| self.entrylabel.pack() | |
| self.entry = Entry(self, text="http://youtube.com/watch?v=") | |
| self.entry.pack() | |
| self.downloadbtn = Button(self, textvariable=self.status, command=self.download) | |
| self.downloadbtn.pack(side="left") | |
| self.quitbtn = Button(self, text="Koniec", command=root.destroy) | |
| self.quitbtn.pack(side="right") | |
| def download(self): | |
| MichiDLFrame(subprocess.call(["youtube-dl",self.entry.get()]), master=self.masterer).mainloop() | |
| root = Tk() | |
| app = MichiTube(master=root) | |
| app.mainloop() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| youtube_dl>=2014.06.02 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment