from tkinter.messagebox import *
from tkinter import *
root = Tk()
photo = PhotoImage(file="./snow.png") #file:t图片路径
imgLabel = Label(root,image=photo,text="初春的雪!") #把图片整合到标签类中
imgLabel.pack(side=RIGHT) #自动对齐
tl = "This is my window"
root.geometry("1024x900") #窗口大小
root.title(tl) #窗口题目
original_background = root.cget("background") #得到窗口背景色
print(original_background)
#root.configure(background=original_background)
root.configure(background="yellow") #设置窗口背景色
data = StringVar()
def action():
print("I am a Button!")
root.title("Click Me!")
root.geometry("+220+150")
root.update()
bg = root.cget("background")
showinfo(bg) #弹出信息窗口
label = Label(root,text="It's me!")
label.pack()
btn = Button(root,text="Enter",command=action)
btn.pack()
ent = Entry(root,textvariable=data)
ent.pack()
chk1 = Checkbutton(root,text="电视")
chk2 = Checkbutton(root,text="电脑")
chk3 = Checkbutton(root,text="电吹风")
chk1.pack()
chk2.pack()
chk3.pack()
frm = Frame(root,bord=6)
frm.pack(side="top")
text = Text(frm,width=30,height=6,background="light blue")
text.pack()
im = Image("雪.jpg",imgtype="jpg")
im.pack
root.mainloop()