[Feature request] Grid / Table layout helper or function
还没有人认领这个 Issue。
评估
调研方向
Start by reviewing the existing nested-list layout behavior and the sg.Column API described in the issue, then compare them with the supplied GridLayout helper. Define how empty cells and consistent dimensions should work, and confirm that the proposed integration has clear tests or examples showing the resulting grid layout.
由索引模型根据 Issue 内容生成。
描述
I'd love something like sg.GridLayout(layout) or sg.TableLayout(layout) analogous to sg.Column(layout). An easy way to arrange elements in a grid.
This is already sort of the default when creating a layout as a nested list of rows where members are placed horizontally in each row, however currently there is no common delineation between those points in the default layout. This should definitely stay that way as it's a sensible way to handle things. Often though we might want elements to stack neatly on top of each with the same dimensions for a clean and readable layout.
This is the default look when layouting with the nested list:
This is the resulting look when wrapping the elements in a grid layout helper:
I'd love to discuss the possibilities for this. I've written a small helper function that can achieve this by itself, but any integration into the codebase will necessarily have to look different. If it would be useful to have though, I'll include that helper here:
def GridLayout(layout):
column_layout = []
columns_num = len(max(layout, key=len))
for i in range(columns_num):
column_list = []
for row_list in layout:
if i < len(row_list):
value = row_list[i]
if value == None: # This allows empty cells.
column_list.append([sg.Text("")])
else:
column_list.append([value])
else:
column_list.append([sg.Text("")])
column_layout.append(sg.Column(column_list))
return column_layout
Using None is the option I went with to allow leaving cells in the grid structure empty. As I'm pretty new with FreeSimpleGUI, I made empty cells happen with empty text elements, but a proper integration could surely do better.
I've been very pleased with FreeSimpleGUI so far, so if there's interest in this and I could get some guidance on how to best integrate something like this, I'd be happy to give it a shot myself when I find time. Any thoughts would be appreciated.
- 主要语言
- Python
- 星标
- 867
- 派生
- 106
- 平均合并
- 1 分钟
- 30 天内合并 PR
- 2
贡献指南
这个仓库没有索引到贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
spyoungtech/FreeSimpleGUI 的其他 Issue
-
难度 1/5 1 小时以内 新手友好度 90/100
spyoungtech/FreeSimpleGUI#109 ·
-
难度 2/5 1-3 小时 新手友好度 68/100
spyoungtech/FreeSimpleGUI#86 · 1 条评论 · 2 个 reaction ·
-
难度 1/5 1 小时以内 新手友好度 58/100
spyoungtech/FreeSimpleGUI#101 · 8 个 reaction ·
-
难度 5/5 一周以上 新手友好度 20/100
spyoungtech/FreeSimpleGUI#95 ·
-
难度 4/5 3-5 天 新手友好度 39/100
spyoungtech/FreeSimpleGUI#93 ·
查看 spyoungtech/FreeSimpleGUI 的全部 Issue
相似的 Issue
-
bug confirmed issue
难度 2/5 1-3 小时 新手友好度 75/100
open-webui/open-webui#30750 · 1 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 75/100
-
enhancement
难度 2/5 1-3 小时 新手友好度 75/100
OpenwaterHealth/openmotion-bloodflow-app#604 · 1 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 70/100
-
good first issue
难度 1/5 1 小时以内 新手友好度 90/100