VIP視頻解析

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'<ctrl+v>粘帖')
        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

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章