lable是基础组件之一:
lable能添加文字和图片
代码如下:
from tkinter import * import sys root=Tk() root.title("第一个tk程序") root.geometry("500x300+100+200") label01=Label(root,text="天下程序员01",width=10,height=2, bg="black",fg="white") label02=Label(root,text="天下程序员02",width=15,height=2, bg="black",fg="white",font=("黑体",30)) photo=PhotoImage(file=sys.path[0]+"/logo.png") label03=Label(root,image=photo,width=190,height=200, bg="black",fg="white") label01.pack() label02.pack() label03.pack() root.mainloop()
效果如下: