代码:
#place布局.py from tkinter import * root=Tk() root.title('登录') root.geometry('400x200') root.config(bg='#ffcc00') Label(root,text='用户名',width=6).place(x=1,y=1) Entry(root,width=20).place(x=45,y=1) Label(root,text='密码',width=6).place(x=1,y=20) Entry(root,width=20,show='*').place(x=45,y=20) Button(root,text='登录',width=8).place(x=40,y=41) Button(root,text='取消',width=8).place(x=110,y=41) root.mainloop() 截图: