# 控件内容设置
group = tk.lable(frame_1, text='请选择一个视频破解方式:',padx=10,pady=10)
tb1 = tk.Radiobutton(frame_1,text='通道一',variable=self.v,value=1,width=10,height=3)
tb2 = tk.Radiobutton(frame_1,text='通道二',variable=self.v,value=2,width=10,height=3)
tb3 = tk.Radiobutton(frame_1,text='通道三',variable=self.v,value=3,width=10,height=3)
lable1 = tk.lable(frame_2,text="请输入视频链接=")
entry = tk.Entry(frame_2,textvariable=self.url,highlightcolor='Fuchsia',highlightthickness=1,width=35)
lable2 = tk.lable(frame_2,text=" ")
play = tk.Button(frame_2,text="播放",font=('楷体',12),fg='Purple',width=2,height=1,
command=self.video_play)
lable3 = tk.table(frame_2,text=" ")
lable_expplain = tk.lable(frame_3,fg='red',font=('楷体',18),
text='\n注意:\n此工具只能用于观看和学习\n详情联系2478363166!')
lable_warning = tk.lable(frame_3,fg='black',font=('楷体',16), text='\n\n')
# 控件布局
frame_1.pack()
frame_2.pack()
frame_3.pack()
group.grid(row=0,column=0)
tb1.grid(row=0,column=1)
tb2.grid(row=0,column=2)
tb3.grid(row=0,column=3)
lable1.grid(row=0,column=0)
entry.grid(row=0,column=1)
lable2.grid(row=0,column=2)
play.grid(row=0,column=3,ipadx=10,ipady=10)
lable3.grid(row=0,column=4)
lable_expplain.grid(row=1,column=0)
lable_warning.grid(rwo=2,column=0)
"""
函数说明:视频播放
"""
def video_paly(self):
# 视频解析网站地址
# port_1 = 'http://jx.618g.com/?url='
port_1 = 'http://jx.quanmingjiexi.com/?url='
port_2 = 'http://www.wmxz.wang/video.php?url='
port_3 = 'http://www.ckmov.vip/aip.php?url='
# 正则表达是否判定为合法链接
if re_match(r'^https?:/{2}\w.+$',self.url.get()):
if self.v.get() ==1:
# 视频链接获取
ip = self.url.get()
# 视频链接加密
ip = parser.quote_plus(ip)
# 浏览器打开
webbrowser.open(port_1 + self.url.get())
elif self.v.get() ==2:
# 链接获取
ip = self.url.get()
# 链接加密
ip = parser.quote_plus(ip)
# 获取time,key,url
get_url = 'http://www.wmx.wang/video.php?url=%s' % ip
# 请求之后立即打开
webbrowser.open(get_url)
elif self.v.get() ==3:
# 链接获取
ip = self.url.get()
# 链接加密
ip = parser.quote_plus(ip)
# 获取time,key,url
get_url = 'http://ckmov.vip/api.php?url=%s' % ip
# 请求之后立即打开
webbrowser.open(get_url)
else:
msgbox.showerror(title='错误',message='视频链接地址无效,请重新输入!')
"""
函数说明:tkinter窗口居中
"""
def center(self):
ws = self.boot.winfo_screenwidth()
hs = self.boot.winfo_screenheight()
x = int((ws / 2) - (self.w /2))
y = int((hs / 2) - (selc.h /2))
self.root.geometry('{}x{}+{}+{}'.format(self.w, self.h,x,y))
"""
函数说明:loop等待用户事件
"""
def loop(self):
self.root.resizable(False, False)
# 窗口居中
self.center()
self.root.mainloop()
if __name__ == '__main__':
app = APP()
app.loop()
The last musical problem has been solved! Thanks, the
crawl video running says I don't have root for the last APP object, really can't solve it.
```python
Traceback (most recent call last):
File "F:\pychrom文件\pythonProject1\VIP TV.py", line 146, in <module>
app.loop()
File "F:\pychrom文件\pythonProject1\VIP TV.py", line 139, in loop
self.root.resizable(False, False)
AttributeError: 'APP' object has no attribute 'root'
Process finished with exit code 1
```python