Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create a scroll with many checkboxes in pysimplegui?

Tags:

pysimplegui

I'm trying to create a GUI with PySimpleGUI that contains many checkboxes with a scroll to the right to it that allows me to move around. I want my GUI to maintain its size by many checkboxes that have.

This is my code:

form = sg.FlexForm("Dynamic Combo")
layout = [[sg.Text('<-- Enlazar Clientes con Páginas web -->')],
    [sg.Text('Dominio: ')], [sg.InputText()],
    [sg.Text('URL del Cliente: (con http:// o https://)')], [sg.InputText()],
    [sg.Button("SELECCIONAR TODOS")], 
    [sg.Checkbox("something")], [sg.Checkbox("something")],
    [sg.Checkbox("something")], [sg.Checkbox("something")],
    [sg.Checkbox("something")], [sg.Checkbox("something")],
    [sg.Checkbox("something")], [sg.Checkbox("something")],
    [sg.Checkbox("something")], [sg.Checkbox("something")],
    [sg.Checkbox("something")], [sg.Checkbox("something")],
    [sg.Checkbox("something")], [sg.Checkbox("something")],
    [sg.Checkbox("something")], [sg.Checkbox("something")],
    [sg.Checkbox("something")], [sg.Checkbox("something")],
    [sg.Checkbox("something")], [sg.Checkbox("something")],
    [sg.Checkbox("something")], [sg.Checkbox("something")],
    [sg.Checkbox("something")], [sg.Checkbox("something")],
    [sg.Checkbox("something")], [sg.Checkbox("something")],
    [sg.Text('')],
    [sg.Submit('Ejecutar'), sg.Cancel('Salir')]
]

form = sg.Window('Enlazador de Páginas Web').Layout(layout)

How can I do it? I've heard that sg.Column allows me something similar, but I've tried to implement it and I have not achieved anything.

like image 566
thecurious Avatar asked Sep 09 '25 14:09

thecurious


1 Answers

You are correct that you can place the layout inside of a Column Element in order to get scroll bars.

Try changing your last line of code to this. It will make your window smaller and add scrollbars. Read more on the parameters available to the Column element.

form = sg.Window('Enlazador de Páginas Web').Layout([[sg.Column(layout, size=(300,300), scrollable=True)]])
form.Read()
like image 96
Mike from PSG Avatar answered Sep 12 '25 23:09

Mike from PSG