因此,我编写了一个pyhton程序,其中包含一个gui,如何将程序转换为桌面应用程序,而无需打开文本编辑器并执行是的。是的代码如下(当我在gui中输入视频名称时,它会在youtube上查找并播放结果页中的第一个视频)
```from selenium import webdriver
from tkinter import *
root=Tk()
root.title('Youtube Video Player')
text=Label(root,text="In order to save time and avoid procrastination.\nEnter the name of the
video you have in mind,and by the power of the gods it will play")
text.pack()
input=Entry()
input.pack()
def vidplayer():
a=str(input.get())
browser=webdriver.Chrome('C:\\Users\\lenovo\\Downloads\\chromedriver')
browser.get('https://www.youtube.com/results?search_query='+a)
video=browser.find_element_by_id('video-title')
video.click()
button=Button(text="Play Video", command=vidplayer)
button.pack()
root.mainloop()```
您可以使用http://www.pyinstaller.org/之类的工具将python代码打包到特定操作系统本机的可执行文件中。你知道吗
听起来你想“冻结”你的代码。那里有很多配电设施。你可以从官方文件开始。你知道吗
Python Wiki - Distribution Utilities
我在cxFreeze和PyInstaller方面都取得了很大的成功。你知道吗
相关问题 更多 >
编程相关推荐