gpt4 book ai didi

python - 如何垂直打包 tkinter 按钮?

转载 作者:行者123 更新时间:2023-11-30 23:09:27 24 4
gpt4 key购买 nike

如何将以下按钮垂直放置而不是水平放置?因为我想把这些按钮垂直放在左边,图片放在右边? “用Python语言”

    self.myParent = parent   
self.myContainer1 = Frame(parent)
self.myContainer1.pack()

self.button1 = Button(self.myContainer1, command=self.button1Click)
self.button1.configure(text="Generate The Fraud Detection File", background= "grey")
self.button1.pack(side=LEFT)
self.button1.focus_force()


self.button3 = Button(self.myContainer1, command=self.button2Click)
self.button3.configure(text=" Cancel ", background="grey")
self.button3.pack(side=RIGHT)


self.button3 = Button(self.myContainer1, command=self.button2Click)
self.button3.configure(text=" Edit ", background="grey")



self.button2 = Button(self.myContainer1, command=self.button3Click)
self.button2.configure(text="Disply The File of Fraud Detection", background="grey")
self.button2.pack(side=RIGHT)

self.button4 = Button(self.myContainer1, command=self.button4Click)
self.button4.configure(text="Display The Monthly Chart", background="grey")
self.button4.pack(side=RIGHT)

最佳答案

创建两个框架。左边一个放按钮,右边一个放其他东西。然后,将按钮添加到左框架并用 side="top"side="bottom" 打包。

不要害怕使用额外的框架将 GUI 划分为多个部分。这样做比尝试使用单个几何管理器将所有内容排列在单个窗口内要容易得多。

关于python - 如何垂直打包 tkinter 按钮?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31196488/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com