【问题标题】:Python button alignmentPython按钮对齐
【发布时间】:2015-04-06 05:11:02
【问题描述】:

我在通过 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()

【问题讨论】:

  • 如果没有看到您的代码,我们将无能为力。这张图是您试图实现的目标,还是您的代码当前做了什么但您想更改?
  • @skrrgwasme,已添加代码

标签: python tkinter


【解决方案1】:

找到了,

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()

构建一个框架然后执行它

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-06-23
    • 1970-01-01
    • 2016-08-28
    • 2021-05-10
    • 2012-09-29
    • 2014-10-13
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多