Open evan-rasmussen opened 1 year ago
That is an interesting question, but I'm very short of time today so this answer is brief and might be described as an educated guess. You might like to experiment.
The dropdown instance has a bound variable .elements
which holds the text values. When the user clicks on the dropdown, a listbox is instantiated here using those elements (see docs for listbox). So it might be possible to modify dropdown.elements
at times when the dropdown is not open. See listbox docs for the two possible formats of .elements
.
I had similar need and I have test implementation for listbox https://github.com/Troyhy/micropython-micro-gui/blob/ESP-Now/gui/widgets/listbox.py#L75-L97 but this is very rough on edges, I did not fully got the updating elements and scroll position right. Crashes if you update list of 0 elements
This is evidently worth doing. I'll investigate this, but it may be a few days before I get the opportunity
Title pretty much explains it. I am trying to get it so the user can input a string that then needs to be added to the elements in a dropdown object. Is there a way to do this dynamically?