In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces how to use Python to make an art signature gadget, the article is very detailed, has a certain reference value, interested friends must read it!
The basic principle of the implementation is: we generate signatures according to the rules of the artistic signature website, simulate the generation of signatures for the request, and then display it in the GUI window generated by tkinter.
The address of the art signature website we selected is http://www.uustv.com/. After opening it, it is shown below:
We then press F12 to open the developer tool and select Network, then enter a name, and then click the design button for me immediately. We can see that the request for generating a signature is as follows:
Now we can generate the signature based on it, and the implementation code is as follows:
Url = 'http://www.uustv.com/'
Name = enter.get ()
If not name:
Messagebox.showinfo ('prompt:', 'Please enter your name')
Else:
Data = {
'word': name
'sizes': 50
# 'fonts':' jfcs.ttf', # Personality signature
# 'fonts':' qmt.ttf', # with a pen
# 'fonts':' bzcs.ttf', # chic signature
# 'fonts':' lfc.ttf', # cursive sign
# 'fonts':' haku.ttf', # Joint document signature
# 'fonts':' zql.ttf', # Business visa
'fonts': 'yqk.ttf', # lovely signature
'fontcolor':'# 000000'
}
Result = requests.post (url, data=data)
Result.encoding = 'utf-8'
Html = result.text
Reg ='. *?
'
Img_path = re.findall (reg, html)
# full path of image
Img_url = url + img_path [0]
# get the content of the image
Response = requests.get (img_url) .content
F = open ('{} .gif '.format (name),' wb')
# write
F.write (response)
# put the picture on the window and display the picture
Bm = ImageTk.PhotoImage (file=' {} .gif '.format (name))
Label = Label (root, image=bm)
Label.bm = bm
# drawing
Label.grid (row=2, columnspan=2)
Then we can display the signature on the GUI window of tkinter. The implementation code is as follows:
# create window
Root = Tk ()
# title
Root.title ('signature Design')
# window size
Root.geometry ('600x300')
# the initial position of the window
Root.geometry ('+ 400,200')
# label controls
Label = Label (root, text=' enter name', font= ('Song style', 16), fg='blue')
Label.grid ()
# input box
Enter = Entry (root, font= ('Song style', 16))
# set the location of the input box
Enter.grid (row=0, column=1)
# Button
Button = Button (root, text=' design signature', font= ('Song style', 16), command=sign)
# set the location of the button
Button.grid (row=1, column=0)
# display window
Root.mainloop ()
Taking the business visa as an example, let's take a look at the effect:
The above is all the contents of the article "how to use Python to make an art signature gadget". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.