Python signature Design

Source: Internet
Author: User

Crawl the content of a signed website http://www.uustv.com/to show it

Code: sign.py

 fromTkinterImport* fromTkinterImportMessageBoxImportRequestsImportRe fromPILImportIMAGE,IMAGETK#impersonate a browser to send a requestdefDownload (): StartURL='http://www.uustv.com/'name=Enter.get ()#name = Name.strip ()    if  notName:messagebox.showinfo ('Tips:','Please enter user name')    Else: Data= {            'Word': Name,'Sizes'76],            'Fonts':'Jfcs.ttf',            'FontColor':'#000000'} result= Requests.post (Starturl,data =data) result.encoding='Utf-8'HTML=Result.text Reg='<div class= "tu" >.*?</div>'ImagePath=Re.findall (reg,html)#Picture Full pathImgurl = StartURL +Imagepath[0]#Get Picture contentResponse =Requests.get (Imgurl). Content F= Open ('{}.gif'. Format (name),'WB') F.write (response)#Write        #How to put the picture on the window, display the pictureBM = imagetk.photoimage (file ='{}.gif'. Format (name)) Label2= Label (Root,image =BM)#Image PropertyLABEL2.BM =BM#DrawingLabel2.grid (row = 2,columnspan = 2)#Create WindowRoot =Tk ()#titleRoot.title ('Signature Design')#The window size, in the middle is the lowercase x, not the multiplication signRoot.geometry ('600x300')#the initial position of the windowRoot.geometry ('+400+300')#Label's ControlsLabel = label (Root,text ='Signature', Font = ('XXFarEastFont-Xingkai', FG ='Red')#Grid Pack PlaceLabel.grid ()#Input BoxEnter = Entry (Root,font = ('Microsoft Ya-Black', 20))#set the position of the input boxEnter.grid (row = 0,column = 1)#Click the buttonbutton = button (Root,text ='Design Signature', Font = ('Microsoft Ya-Black', (), command = download)#calling Functions#set the location of the click buttonButton.grid (row = 1,column =0)#message loops, which can be understood as display WindowsRoot.mainloop ()
View Code

On the GUI operation of graphical interface before the blog has said, mainly three steps:

1. Root = Tk ()

2. Place components such as labels and buttons in

3, Root.mainloop ()

Here is requests to request a Web page, post incoming parameter URL and data,data how to get it?

Open the browser, enter the URL and then right-check the element, click on the network, refresh the page to delete the previous record, and then enter the name click to get the signature

Then get the page as follows:

Note that the parameter on the right is the data we need, but the input name has been changed and the remaining three will not change.

Then convert the py file to the EXE file executed on window

Need to download Pyinstaller and pywin32-221.win-amd64-py3.6, where py3.6 refers to the Python version is 3.6,amd64 refers to the 64-bit, depending on the situation.

Https://sourceforge.net/projects/pywin32/files/pywin32/Build%20220/pywin32-221.win-amd64-py3.6.exe/download

After downloading the installation, execute Pyinstaller-f sign.py in the same directory as the sign.py file.

A directory structure similar to the following is generated in the current directory:

There is a newly generated EXE file in the Dist directory that can be executed by clicking Execute and moving to another directory.

The effect is as follows:

Python signature Design

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.