sovann
sovann

Reputation: 117

Dropdown menus in PysimpleGUI

I am looking for a PysimpleGUI way to create dropdown menus. Currently, I can create ComboBoxes as such:

import PySimpleGui as sg
sg.Combo(list1, size = params)

This creates an Input box and a dropdown list with a slider populated by list1 elements.


However, my users are very sloppy with inputs and I'd like to restrict them to a simple dropdown list.


Now I know I could maybe use the ListBox element but it doesn't have a slider/seems much less versatile than Combo.


What other arguments could I pass to Combo to make this work?


NB:In the documentation they state that Combo == InputCombo == Drop == DropDown but without giving more details but it confuses me a lot.

Upvotes: 2

Views: 18111

Answers (2)

Jerry wu
Jerry wu

Reputation: 922

Set the readonly to True

sg.Combo(..., readonly=True)

Upvotes: 2

sovann
sovann

Reputation: 117

There is no slider when ListBox is has not enough entries however one appears when enough are added.

sg.Listbox(list(df_names.NAMES), size=(20,4), enable_events=False, key='_LIST_')

Upvotes: 2

Related Questions