[英]Can I create different row numbers inside two columns using tkinter?
First of all, this is my first topic and I would like to greet you all and in advance thank you for all your help.首先,这是我的第一个话题,我想向大家问好,并提前感谢大家的帮助。 I am a programming newbie.
我是编程新手。 I started learning python a few months ago and now I'm trying to make (and I did it) a functional GUI for a friend, but my "customer" has some layout wishes and I'm having trouble arranging it the way he wants me to.
几个月前我开始学习 Python,现在我正在尝试为朋友制作(并且我做到了)一个功能性 GUI,但是我的“客户”有一些布局愿望,我无法按照他想要的方式安排它我也是。 This is how I need it to look like:
这就是我需要它的样子:
Basically, if I know how to create different row numbers inside two columns, I might even do it by myself.基本上,如果我知道如何在两列内创建不同的行号,我什至可以自己完成。 I've searched online but couldn't find the solution.
我在网上搜索过,但找不到解决方案。
You can nest widget management tools by using the Frame widget.您可以使用框架小部件嵌套小部件管理工具。
root = tk.Tk()
left_side = tk.Frame(root)
right_side = tk.Frame(root)
left_side.grid(row=0, column=0)
right_side.grid(row=0, column=1)
entrybox = tk.Entry(left_side, ...args...)
listbox1 = tk.Entry(left_side, ditto)
listbox2 = tk.Entry(left_side, etc)
listbox3 = tk.Entry(left_side, yeah)
entrybox.grid(row=0, column=0)
listbox1.grid(row=2, column=0)
listbox2.grid(row=3, column=0)
listbox3.grid(row=4, column=0)
spinbox = tk.Spinbox(right_side, . . . )
< all those things >
spinbox.grid(row=0, column=0)
the_next_one.grid(row=1, column=0)
that's just an example, and I left a lot to be filled in, but I hope that shows you what I am talking about这只是一个例子,我还有很多需要填写,但我希望这能告诉你我在说什么
You can also use columnspan and rowspan, take a good look at this page: https://effbot.org/tkinterbook/grid.htm You could have that top listbox span 5 or 6 rows and put all the buttons on the right in those rows but in the right column.您还可以使用 columnspan 和 rowspan,好好看看这个页面: https ://effbot.org/tkinterbook/grid.htm 你可以让顶部列表框跨越 5 或 6 行,并将所有按钮放在右边行,但在右列。
Hope that helps, feel free to ask questions or for more examples!希望有帮助,请随时提问或提供更多示例!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.