码迷,mamicode.com
首页 > 微信 > 详细

签名小程序

时间:2020-06-03 21:58:04      阅读:487      评论:0      收藏:0      [点我收藏+]

标签:enc   nts   int   span   findall   geo   urllib   oop   商务   

from tkinter import *
from tkinter import messagebox
import requests
import re
from urllib.request import urlretrieve
from PIL import ImageTk
from tkinter import ttk


def download():
    path = ./签名图.gif
    Url2 = http://m.uustv.com/
    name = entry.get()
    name = name.strip()
    fonts1 = choice.get()
    if name == ‘‘:
        messagebox.showinfo(提示:,请输入有效名字)
    else:
        if fonts1 == 个性签:
            fonts1=jfcs.ttf
        elif fonts1 == 连笔签:
            fonts1=qmt.ttf
        elif fonts1 == 潇洒签:
            fonts1=bzcs.ttf
        elif fonts1 == 草体签:
            fonts1=lfc.ttf
        elif fonts1 == 合文签:
            fonts1=haku.ttf
        elif fonts1 == 商务签:
            fonts1=zql.ttf
        else :
            fontsl=yqk.ttf

    #爬取代码是借鉴别人的  
        data1 = {
            word:name,
            sizes:60,
            fonts:fonts1,
            fontcolor:#000000
            }
        req = requests.post(Url2, data=data1)
        req.encoding = req.apparent_encoding
        reg = re.compile(<div class="tu"><img src="(.*?)"/></div>)
        res = re.findall(reg,req.text)
        res = Url2 + res[0]
        urlretrieve(res,path)
        bm = ImageTk.PhotoImage(file = path)
        L1 = Label(root,image = bm)
        L1.bm = bm
        L1.grid(row = 2,columnspan = 3)

# 以下代码是大家设计的
root = Tk()

root.title("生成签名小软件")

root.geometry("600x310+400+150")

label = Label(root,text = "请输入签名",font = ("华文行楷",20),fg="blue")

label.grid()

entry = Entry(root,font = (微软雅黑,20))

entry.grid(row = 0,column = 1)

button1 = Button(root,text = 点击设计签名,font = (微软雅黑,20),command = download)

button1.grid(row=1,column=1)

choice = ttk.Combobox(root,width = 6)

choice.grid(row = 0,column = 3)

choice[values] = (个性签,连笔签,潇洒签,草体签,合文签
                    ,商务签,可爱签)
choice.current(0)

root.mainloop()

 

签名小程序

标签:enc   nts   int   span   findall   geo   urllib   oop   商务   

原文地址:https://www.cnblogs.com/qq1294/p/13040252.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有 京ICP备13008772号-2
迷上了代码!