我寫了一隻程式,這隻程式需要有檔案入近,我用button去執行music 在music這層內可以顯示入進,但在plus是無法讀取的,兩個是不同的按鈕,怎解?
def plus():
while True:
path = 'output.bat'
f = open(path, 'w')
name=test1.get()
num=test2.get()
flow=test3.get()
print("""if "%1"=="hide" goto CmdBegin""", file=f)
print("start mshta vbscript:createobject(\"wscript.shell\").run(\"\"\"%~0\"\" hide\",0)(window.close)&&exit", file=f)
print(":CmdBegin", file=f)
print(music)
print("shengsong -f lavfi -i anullsrc -rtsp_transport tcp -i \""+name+"\" -f flv -re -stream_loop -1 -f mp3 -i "+str(music)+" -acodec libmp3lame -ab 128k -ac 2 -ar 44100 -loop 1 -shortest -c:v libx264 -b:v "+str(flow)+"k -c copy -f mpegts -f flv \""+str(num)+"\"\nexit", file=f)
f.close()
messagebox.showinfo('系統訊息',"按下確定及執行。")
from subprocess import Popen
p = Popen("rcu.bat")
print(p)
return_msg.set("正在直播中")
break
def music():
music = filedialog.askopenfilename()
return music.title()