I have a button at my window. If I cklick it, I want to start the VLC and stream an URL.
def startstream():
args = ['C:/Program Files/VideoLAN/VLC/vlc.exe', 'http://dreambox:8001/1:0:19:7B:B:85:C00000:0:0:0:']
subprocess.call(args)
# Buttons
button_tnt = Button(fenster, text = "TNT Serie HD", command = startstream)
This works as I want.
The following one doesn't work like I want it and I have no idea why not.
def startstream(url):
args = ['C:/Program Files/VideoLAN/VLC/vlc.exe', url]
subprocess.call(args)
# Buttons
button_tnt = Button(fenster, text = "TNT Serie HD", command = startstream('http://dreambox:8001/1:0:19:7B:B:85:C00000:0:0:0:'))
With the first code, the window appears and nothing happen. If I click the button, the stream starts, perfect.
Second code: I run the script and the stream starts immediatelly. After I close the VLC I cannot reopen the stream over the button, it has no function.
But I want to use the second code. I have more than one button and so I can only change the argument for each button. With the first code I have to write a new function for every stream.
Please help me :(
Thanks!
command=startstream(blah)is calling startstream immediately. You need to still havecommand=startstreambut a way of passing the arg to it