[python]代码库
import qrcode
from tkinter import *
from PIL import Image
from PIL import ImageTk
root = Tk()
root.title('二维码之谜')
root.geometry('400x600+300+100')
root.resizable(0,0)
img = qrcode.make('https: // kbhgames.com/game/friday-night-funkin-the-tricky-mod').resize((150, 150))
img.save('mcc.png')
img = Image.open('mcc.png')
pic = ImageTk.PhotoImage(img)
img_label = Label(root,image = pic)
img_label.place(x=130,y=450)
name_label = Label(root, text='姓名', font=('微软雅黑', 20))
name_label.place(x=50,y=30)
name_entry = Entry(root, font=('微软雅黑', 15))
name_entry.place(x=150,y=35)
age_label = Label(root, text='地区', font=('微软雅黑', 20))
age_label.place(x=50, y=100)
age_entry = Entry(root, font=('微软雅黑', 15))
age_entry.place(x=150, y=105)
inter_label = Label(root, text='简介', font=('微软雅黑', 20))
inter_label.place(x=50, y=170)
inter_text = Text(root, font=('微软雅黑', 15),width=20,height=4)
inter_text.place(x=150, y=175)
area_label = Label(root, text='地区', font=('微软雅黑', 20))
area_label.place(x=50, y=300)
area_entry = Entry(root, font=('微软雅黑', 15))
area_entry.place(x=150, y=305)
def clear():
name_entry.delete(0,'end')
age_entry.delete(0,'end')
area_entry.delete(0, 'end')
inter_text.delete(0.0,'end')
clear_btn = Button(root, text='清空内容', font=('微软雅黑', 15), command=clear)
clear_btn.place(x=80,y=400)
def create():
n = name_entry.get()
a = age_entry.get()
r = area_entry.get()
i = inter_text.get(0.0,'end')
t = '姓名:%s\n地区:%s\n年龄:%s\n简介:%s'%(n,r,a,i)
img = qrcode.make(t).resize((150, 150))
img.save('mcc.png')
img = Image.open('mcc.png')
pic = ImageTk.PhotoImage(img)
img_label.configure(image = pic)
img_label.image=pic
create_btn = Button(root, text='生成二维码', font=('微软雅黑', 15), command=create)
create_btn.place(x=230,y=400)
root.mainloop()
[源代码打包下载]