Python 按钮对齐

Python button alignment

我在通过 PyCharm 使用 TKinter 时遇到问题。 按钮放置一直在运行.

我试过网格和打包,但没有成功。 即使是 row , anchor 但我总是得到不同的结果。

jay = Tk()
jay.title("Awesome Software")
jay.geometry("720x560")

searchbutton = Button(jay, text="Setting")
searchbutton.pack(side=TOP)

stopbutton = Button(jay, text="Stop")
stopbutton.pack(side=TOP)

setbutton = Button(jay, text="Search")
setbutton.pack(side=TOP)

mainloop()

找到了,

jay = Tk()
jay.title("Awesome Software")
jay.geometry("720x560")

but_frame = Frame(jay)
searchbutton = Button(but_frame, text="Search")
searchbutton.pack(side=TOP, padx=20,pady=10)

stopbutton = Button(but_frame, text="Stop")
stopbutton.pack(side=TOP,pady=10)

setbutton = Button(but_frame, text="Settings")
setbutton.pack(side=TOP,pady=10)

but_frame.pack(side=LEFT)

mainloop()

先建个框架再做