Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

[Feature request] Grid / Table layout helper or function

Abierto
#99 0 comentarios 1 reacción 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
5/5
Tiempo estimado
Más de una semana
Aptitud para principiantes
35/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
python
Área
desktop

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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:
Image

This is the resulting look when wrapping the elements in a grid layout helper:
Image

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.

Lenguaje dominante
Python
Estrellas
866
Forks
106
Métricas de merge de PR
Sin PR fusionados en 30 d

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de spyoungtech/FreeSimpleGUI

Todos los issues de spyoungtech/FreeSimpleGUI

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.