Hi guys i have made a simple gui to to run a single line of code, until now i run via cmd the command is
youtube-dl.py http://www.youtube.com/ --extract-audio --audio-format mp3
now i want to run this command with my gui.
My gui is this:
#!/usr/bin/python
import wx
APP_SIZE_X = 300
APP_SIZE_Y = 200
class MyButtons(wx.Dialog):
def __init__(self, parent, id, title):
wx.Dialog.__init__(self, parent, id, title, size=(APP_SIZE_X, APP_SIZE_Y))
wx.Button(self, 1, 'Close', (50, 130))
wx.Button(self, 2, 'Run', (150, 130), (110, -1))
self.Bind(wx.EVT_BUTTON, self.OnClose, id=1)
self.Bind(wx.EVT_BUTTON, self.OnRun, id=2)
self.Centre()
self.ShowModal()
self.Destroy()
def OnClose(self, event):
self.Close(True)
def OnRun(self,event):
print "ok for now"
app = wx.App(0)
MyButtons(None, -1, 'buttons.py')
app.MainLoop()
I need some help please, and thanks for your help...
You could just import subprocess and call your script that way. Something like this:
def OnRun(self,event):
path = "/path/to/youtube-dl.py"
url = "http://www.youtube.com/"
subprocess.Popen(path, url, "--extract-audio", "--audio-format", "mp3")
See the docs for more information: http://docs.python.org/2/library/subprocess.html