:
The implementation steps are as follows:
The principle of implementation : In fact, a layer of GUI shell, the main crawler crawl a site to return the data, and then use Python's own GUI toolkit tkinter to implement the GUI interface:
1. Crawler Analysis:
Target site: http://www.uustv.com
1. You can see that the data is passed through the submission form
Parameters are:
#000000
2. Find the returned picture data in the returned response,
3, the main realization of logic
Response = Requests.post (URL, data=data, headers=headers) response.encoding='Utf-8' #specifies the encoding format of the returned data because the default encoding for the response content is iso-8859-1
# Latin-1 includes additional characters that are indispensable for writing all Western European languages
# or you can write directly to HTML = Reponse.content.decode ("Utf-8")
HTML =Response.text
IMG= Re.findall (r'<div class= "tu" >.*?src= "(. *?)". *?</div>', HTML) [0]
#print (' img: ', img)
Image_url ='http://www.uustv.com/%s'%img
#Download Image
res = Requests.get (image_url). Content
2: Understanding Python's own GUI interface module Tkinter
Tkinter module ("Tk interface") is the interface of Python's standard Tk GUI toolkit
Implement a GUI
from Import # define an Interface object master = Tk ()# run GUI, window persistence master.mianloop ()
3:gui settings (see also notes, Tkinter documentation)
#GUI module, python2.7 is Tkinter #Creating a Window control objectRoot =Tkinter. Tk () Root.title ('Pythongui Signature Design') #root.geometry (' 600x300 ') #root.geometry (' +400+200 ')Root.geometry ('550x360+400+200')#Specifies the window size, and the offset that is displayed on the screen where it appears #set a radio box, storage type is a string, options is the option to crawl down from the Webvar =stringvar () var.set ('Jfcs.ttf')#set a default optionCount =0 formode, textinchoptions:b= Radiobutton (Master=root, Text=text, Variable=var, value=mode) B.grid (Row=1, column=count) Count+ = 1#The text input box starts on the second linelabel = Tkinter. Label (Root, text='Name:', Font= ('Microsoft Ya-Black', 15)) Label.grid (Row=2, Column=0, pady=5) #Create a text boxName_entry = Tkinter. Entry (Root, font= ('Microsoft Ya-Black', 20)) Name_entry.grid (Row=2, Column=1, columnspan=6, pady=5) #Displays the default picture, in the first linedefault_img = Photoimage (file='images/Blue Moon. gif') Label= Label (Root, image=default_img) Label.grid (Row=0, Column=0, Columnspan=count, pady=10) #Set ButtonTkinter. Button (Root, text='One-click Design Signature', Font= ('Microsoft Ya-Black', width=),' the', height='1', Command=getimg). Grid (Row=3, Column=1, columnspan=5, pady=5) Root.mainloop ()#window Persistence
Project Code: Please click
Above, the shortcomings, please give more advice, thanks~!
Reference: http://effbot.org/tkinterbook/label.htm
Https://www.cnblogs.com/kongzhagen/p/6154903.html
Python crawler Exercises--Signer +gui interface (Tkinter)