我该如何以我想要的方式设置此GUI?
我正在使用Guizero在Python中制作一个简单的GUI,我希望它看起来很像: ,
但是我正在编码,由于某种原因,我得到了一个空白的空间,这正在移动我的元素。另外,我在底部框中对齐底部,但是除非我使窗户增长,否则它们不会显示: 当我使窗户生长时,两个盒子出现了:
我在做什么错?我真的没有找到有关Guizero的文档
I'm using Guizero to make a simple GUI in Python, and I want it to look pretty much like this:
But I'm coding and for some reason I'm getting a blank space which is moving my elements. Also, I'm usign align bottom in my bottom boxes but they don't show unless I make the window grow:
When I make the window grow the two boxes appear:
What am I doing wrong? I didn't really find much documentation on Guizero
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Guizero的文档在这里: https://lawsie.github.io/guizero/ ,单击小部件菜单下拉菜单。我觉得很好。
使用Guizero很简单,但并不容易。它可以做到它做的事情,但是很难做到自己真正想要做的事情。
我发现,必须将它们放在表格的每个功能区域中的盒子中,以阻止他们在吉泽尔中的对象,以阻止他们决定自己想要的位置。在您的情况下,左右框需要在顶部和底部框之间的“中间”框中。这摆脱了额外的空间。
我还发现,我需要添加填充物以阻止对象离边缘太近,并且彼此之间,并在网格布局中强迫布局。对于填充,我使用带有空文本的“文本”小部件,并以宽度和高度属性为文本小部件的字符大小来控制其大小。
我已经大致说明了您所说的您想要的话。注意中间箱和填充“文本”小部件,尤其是在网格中的按钮周围。还要注意,尽管剩下对齐,但选项和输入文本仍会变化,嗯。
由下面的代码产生的表单
Documentation for Guizero is here: https://lawsie.github.io/guizero/, click on the Widgets menu dropdown. I find it pretty good.
Using guizero is simple but not easy. It does what it does but, it is difficult to get it to do what you really want it to do.
I find that one has to constrain objects in guizero, to stop them deciding themselves where they want to be, by putting them in boxes in each functional area of your form. In your case the left and right boxes need to be in a "middle" box between your top and bottom boxes. This gets rid of the extra space.
I also find that I need to add padding to stop objects being too close to edges and to each other, and to force the layout, for example, in grid layout. For padding I use a "Text" widget with empty text, and control its size with the width and height properties which are character sizes for the text widget.
I have made a rough example of what you said that you wanted. Note the middleBox, and the padding "Text" widgets especially around the buttons in the grid. Note also that the option and input text varies position in spite of being left aligned, ah well.
Form produced by the code below