import tkinter
from PIL import Image,ImageTk
from tkinter import filedialog
import os
from amzqr import amzqr
tk=tkinter.Tk()
tk.geometry("400x400")
tk.resizable(0,0)
bg_image=Image.open("qrcode_bg.jpg")
bg_image=ImageTk.PhotoImage(bg_image)
bg_label=tkinter.Label(tk,image=bg_image)
bg_label.pack()
text1=tkinter.Text(tk,font=("华文行楷",12),width=30,height=5)
text1.place(x=80,y=100)
text2=tkinter.Text(tk,font=("华文行楷",12),width=23,height=1)
text2.place(x=80,y=250)
def get_pic():
    pic_path=filedialog.askopenfilename()
    text2.delete("1.0","end")
    text2.insert("1.0",pic_path)
btn2=tkinter.Button(tk,text="浏览",font=("华文行楷",12),command=get_pic)
btn2.place(x=312,y=250,height=25)
def qr():
    word=text1.get("1.0","end")
    word="".join(word.split("\n"))
    picture=text2.get("1.0","end")[:-1]
    version,level,qr_name=amzqr.run(words=word,picture=picture,colorized=True)
    os.system(qr_name)
btn1=tkinter.Button(tk,text="生成二维码",font=("华文行楷",15),command=qr)
btn1.place(x=80,y=300,width=250)
tk.mainloop()