程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式師世界 >> 編程語言 >  >> 更多編程語言 >> Python

Python makes GUI small software, and VIP movies can be viewed by inputting links.

編輯:Python

We see the movie we want to see , Often need VIP Or pay directly , But I'm too lazy to spend money , This is the time Python It works !

Everyone quietly uses , Don't tell anyone

Code flow

# Regular expressions Data matching
import re
import tkinter as tk
# url Address resolution
from urllib import parse
# Message box
import tkinter.messagebox as msgbox
# Control browser
import webbrowser
class App:
# Override constructor Create class attribute
def __init__(self, width=500, height=300):
# Create custom class attributes
self.w = width
self.h = height
# Software name
self.title = ' Video Parsing assistant '
# tk object
self.root = tk.Tk(className=self.title)
# Variable to receive the movie address entered by the user And deal with the address
self.url = tk.StringVar()
# Control the attribute selected by default in the radio box
self.v = tk.IntVar()
self.v.set(1)
# Software space division
frame_1 = tk.Frame(self.root)
frame_2 = tk.Frame(self.root)
# Software control content settings
group = tk.Label(frame_1, text=' Playback channel :', padx=10, pady=10)
tb = tk.Radiobutton(frame_1, text=' The only way ', variable=self.v, value=1, width=10, height=3)
label = tk.Label(frame_2, text=' Please enter the video playback address :')
entry = tk.Entry(frame_2, textvariable=self.url, highlightcolor='Fuchsia', highlightthickness=1, width=30)
play = tk.Button(frame_2, text=' Play ', font=(' Regular script ', 12), fg='Purple', width=2, height=1, command=self.video_play)
# Control layout
'''
Activate space
'''
frame_1.pack()
frame_2.pack()
'''
Determine the location
'''
group.grid(row=0, column=0)
tb.grid(row=0, column=1)
'''
Space 2 The location of the control does not need to see space 1 The location of
Space and space are independent
'''
label.grid(row=0, column=0)
entry.grid(row=0, column=1)
play.grid(row=0, column=2, ipadx=10, ipady=10)
# Define the event function of the play button
'''
Analyze movies
'''
def video_play(self):
# Third party playback analysis api
port = 'http://www.wmxz.wang/video.php?url='
# Judge whether the movie address entered by the user is legal
if re.match(r'https?:/{2}\w.+$', self.url.get()):
ip = self.url.get()
ip = parse.quote_plus(ip)
# Open browser automatically
webbrowser.open(port + ip)
else:
msgbox.showerror(title=' error ', message=' The video address is invalid , Please re-enter ...')
# How to start the software
def loop(self):
self.root.mainloop()
if __name__ == '__main__':
app = App()
app.loop()

  perfect , The complete code can be obtained here


  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式師世界 All Rights Reserved