我想知道是否有办法制作grids
rows
并columns
适合设置的大小Frame
。因此,如果我创建一个Frame
并设置它的大小,grid
它将适合Frame
.
这是我到目前为止所尝试的:
window = Tk()
frame = Frame(window)
frame.place(x=0, y=0, width=200, height=200)
title = Label(frame, text="The Title", bg="cornflower blue", height=2)
title.grid(row=0, column=0, sticky=NSEW)
sort_button = Button(frame, text="The Button", relief="groove", height=2, bg="maroon1",)
sort_button.grid(row=1, column=0, sticky=NSEW)
window.mainloop()
例如,这是我当前代码的输出:
但这就是我想要的: