[Python] 纯文本查看 复制代码 import tkinter
from PIL import Image, ImageTk
root = tkinter.Tk()
# 图片要放在同一个目录下面,利用 img = Image.open(ImgPath) 打开的图片是PIL类型的
img_open = Image.open("图片1.png")
img_png = ImageTk.PhotoImage(img_open)
#创建一个标签显示图片
#compoundcenter,left,right,top,bottom
label_img = tkinter.Label(root, text='欢迎来到,王者荣耀!', compound='bottom', font=('微软雅黑', 30), image=img_png)
label_img.pack()
#--------------------
root.mainloop()
|