本帖最后由 paypojie 于 2023-1-3 20:28 编辑
被模仿图
实现的效果图(差不多)
代码
[Python] 纯文本查看 复制代码 from tkinter import *
win = Tk()
win.geometry('450x250+300+200')
frame = Frame(win,width=449,height=249,borderwidth=2,relief=RIDGE)
frame.pack()
lb1 = Label(frame,text='位置1',bg='blue',fg='white')
lb1.place(x=40,y=40,width=60,height=30)
lb2 = Label(frame,text='位置2',bg='purple',fg='white')
lb2.place(x=180,y=100,anchor=NE,width=60,height=30)
lb3 = Label(frame,text='位置3',bg='green',fg='white')
lb3.place(relx=0.6,rely=0.4,width=60,height=30)
lb4 = Label(frame,text='位置四',bg='gray',fg='white')
lb4.place(relx=0.01,y=100,relwidth=0.2,height=100)
win.mainloop() |