简体   繁体   English

我可以使用 tkinter 在两列内创建不同的行号吗?

[英]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.

相关问题 使用 tkinter 创建两列输入字段 - Create two columns of entry fields using tkinter 如何“行绑定”具有不同列的两个熊猫数据框? - How can I 'row bind' two pandas dataframes with different columns? 如何连接两个 pandas 列并使用该行创建一个新列? - How can I concat Two pandas columns and create a new with the row? 如何在 python tkinter 中的两个输入字段编号之间创建一个随机数? - How can I create a random number between two entry field numbers in python tkinter? 如何基于两个不同的列创建列目标? - How can I create a column target based on two different columns? 如何使用Python和Tkinter创建带有两列标签的框架? - How To Create Frame With Two Columns of Labels using Python and Tkinter? 如何创建具有随机数列的数据框,每个列具有不同的范围? - How can I create a dataframe with random numbers columns, each with a different range? 如果两列的值不同,则在 dataframe 中创建新行 - Create new row in a dataframe if values from two columns are different 如何在Python中创建dataframe中两列的交叉表,并在output中生成总行列? - How can I create a cross-tab of two columns in a dataframe in Python and generate a total row and column in the output? 如何将函数分配给 Tkinter 中具有两个不同变量的按钮? - How can I assign a function to a button in Tkinter with two different variables?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM