tkinter-Label(加载文字图片)

import tkinter as tk

filename = 'C:\\Users\\i\\Desktop\\background1.png'
root = tk.Tk()
photo = tk.PhotoImage(file=filename)
label1 = tk.Label(root,text='学习python', justify='left', 
                  image=photo,compound='center',font=('微软雅黑',20),fg='white')
label1.pack()
root.mainloop()

猜你喜欢

转载自blog.csdn.net/lucky_kai/article/details/70232535