我想创建一个布局,其中我有类似于 BoxLayout 的东西,让我能够在我的布局中创建行",并且在每个行"中我想使用另一种 BoxLayout 中的东西来创建列".
I want to create a layout where I have something similar to a BoxLayout to give me the ability to create "rows" in my layout, and in each "row" I want to use something in the sorts of another BoxLayout to create "columns".
列不需要均匀分布.例如,我想创建一个 BoxLayout,其中一列是方形图像,另一列占据剩余的可用宽度.
The columns don't need to be evenly distributed. For example, I want to create a BoxLayout with one column with a square image, and another occupying the rest of the available width.
在我的 gist 上查看代码和屏幕截图:https://gist.github.com/MichaelGradek/e5c50038b947352d9e79
See code and screenshot on my gist: https://gist.github.com/MichaelGradek/e5c50038b947352d9e79
我已经在上面的代码中完成了基本结构,但除此之外,我希望 BoxLayout 的高度适应孩子的高度.
I have the basic structure done in the code above, but in addition, I want the BoxLayout's height to adapt to the height of the children.
实现这一目标的最佳方法是什么?
What would be the best approach to achieve this?
谢谢!
不要使用 BoxLayout,使用 height: self.minimum_height 的 GridLayout,并手动设置尺寸(每个子小部件的 size_hint_y: None 和 height: some_number).
Don't use a BoxLayout, use a GridLayout with height: self.minimum_height, and set a manual size (size_hint_y: None and height: some_number) for each child widget.
这篇关于Kivy 布局高度以适应子小部件的高度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!
如何制作一个在 Python 中提供角色的不和谐机器人How to make a discord bot that gives roles in Python?(如何制作一个在 Python 中提供角色的不和谐机器人?)
Discord 机器人没有响应命令Discord bot isn#39;t responding to commands(Discord 机器人没有响应命令)
你能得到“关于我"吗?Discord 机器人的功能?Can you Get the quot;About mequot; feature on Discord bot#39;s? (Discord.py)(你能得到“关于我吗?Discord 机器人的功能?(不和谐.py))
message.channel.id Discord PYmessage.channel.id Discord PY(message.channel.id Discord PY)
如何在 heroku 上托管我的 discord.py 机器人?How do I host my discord.py bot on heroku?(如何在 heroku 上托管我的 discord.py 机器人?)
discord.py - 自动更改角色颜色discord.py - Automaticaly Change an Role Color(discord.py - 自动更改角色颜色)