Python tkinter库(label)

import tkinter as tk

chuangkou=tk.Tk()
chuangkou.title("我的GUI")
sw=chuangkou.winfo_screenwidth()
sh=chuangkou.winfo_screenheight()
sw_=(sw-400)/2
sh_=(sh-350)/2
chuangkou.geometry("400x350+{:.0f}+{:.0f}".format(sw_,sh_))

**#label**
label1=tk.Label(chuangkou,text="你好")
label1.pack()

label2=tk.Label(chuangkou,bitmap="question")
label2.pack()

image_file=tk.PhotoImage(file=r"C:\Users\许博\Desktop\welcome.gif")
label3=tk.Label(chuangkou,image=image_file)
label3.pack()

chuangkou.mainloop()

你可能感兴趣的:(Python tkinter库(label))