后续技术类文档更新到微信公众号-------->>喜欢的扫码关注
VIP视频解析---------学习用 禁止商业用途
#!/usr/bin/env python
#-*- coding:utf-8 -*-
"""
Created on Sun Mar 12 21:47:26 2017
@author: Jerry Xu
"""
import os, sys
import webbrowser
try:
from tkinter import *
except ImportError: #Python 2.x
PythonVersion = 2
from Tkinter import *
from tkFont import Font
from ttk import *
#Usage:showinfo/warning/error,askquestion/okcancel/yesno/retrycancel
from tkMessageBox import *
#Usage:f=tkFileDialog.askopenfilename(initialdir='E:/Python')
#import tkFileDialog
#import tkSimpleDialog
else: #Python 3.x
PythonVersion = 3
from tkinter.font import Font
from tkinter.ttk import *
from tkinter.messagebox import *
#import tkinter.filedialog as tkFileDialog
#import tkinter.simpledialog as tkSimpleDialog #askstring()
class Application_ui(Frame):
#这个类仅实现界面生成功能,具体事件处理代码在子类Application中。
def __init__(self, master=None):
Frame.__init__(self, master)
self.master.title(u'全站VIP视频解析 v0.1')
self.master.geometry('326x210')
self.master.resizable(0,0)
self.createWidgets()
def createWidgets(self):
self.top = self.winfo_toplevel()
self.style = Style()
self.Text1Var = StringVar(value=u'粘帖')
self.Text1 = Entry(self.top, textvariable=self.Text1Var, font=(u'宋体',12))
self.Text1.place(relx=0.049, rely=0.305, relwidth=0.887, relheight=0.157)
gb['t1'] = self.Text1Var
self.style.configure('Label1.TLabel',anchor='w', font=(u'方正兰亭超细黑简体',12,'bold'))
self.Label1 = Label(self.top, text=u'请复制视频网站的VIP视频地址:', style='Label1.TLabel')
self.Label1.place(relx=0.074, rely=0.076, relwidth=0.837, relheight=0.157)
self.style.configure('Label2.TLabel',anchor='w', font=(u'宋体',9, 'bold'))
self.Label2 = Label(self.top, text=u'本软件仅作学习研究,禁止商业用途!', style='Label2.TLabel')
self.Label2.place(relx=0.07, rely=0.648, relwidth=0.68, relheight=0.31)
self.Command1 = Button(self.top, text=u'视频解析', command=self.Command1_Cmd)
self.Command1.place(relx=0.736, rely=0.533, relwidth=0.199, relheight=0.386)
self.Label3Var = StringVar(value=u'解析状态:未开始')
self.style.configure('Label3.TLabel',anchor='w', font=(u'宋体',9,'bold'))
self.Label3 = Label(self.top, text=u'解析状态:', textvariable=self.Label3Var, style='Label3.TLabel')
self.Label3.place(relx=0.074, rely=0.495, relwidth=0.617, relheight=0.119)
gb['l3'] = self.Label3Var
class Application(Application_ui):
#这个类实现具体的事件处理回调函数。界面生成代码在Application_ui中。
def __init__(self, master=None):
Application_ui.__init__(self, master)
def Command1_Cmd(self, event=None):
if len(gb['t1'].get()) == 0:
gb['l3'].set(u'解析状态:输入内容不能为空!')
return
try:
url = 'http://qtzr.net/s/?qt=' + gb['t1'].get().encode('utf-8')
webbrowser.open_new(url)
gb['l3'].set(u'解析状态:正在解析中......')
except:
gb['l3'].set(u'解析状态:失败,请重新输入!')
gb = {}
if __name__ == "__main__":
top = Tk()
Application(top).mainloop()
try: top.destroy()
except: pass