I have a GUI containing an Option box where options can be added or removed while running.
Expected Behaviour
When setting, if the value contains a string, it represents the item to select. If the value is a list, it should change the values.
Actual Behaviour
When setting, the value should contain the item to select.
Sample code, demonstrating the issue
with gui("MyGUI", bg="lightblue") as app:
app.option("corpora", value=parser.list_corpora(), label="Corpora",
change=update_corpora, colspan=2)
app.entry("corpus_name", label="Corpus Name:", colspan=2)
app.button("add_corpus", update_corpora, label="Add Corpus")
app.button("remove_corpus", update_corpora, label="Remove Corpus", row=1,
column=1)
def update_corpora(value):
if value is "add_corpus":
name = app.entry("corpus_name")
parser.save_corpus(name, app.text("corpus"))
app.option("corpora", value=parser.list_corpora()) #Here, I'd like to update the values
app.option("corpora", selected=name) #Here, I'd like to select the new entry
elif value is "remove_corpus":
parser.remove_corpus(app.option("corpora"))
app.option("corpora", value=parser.list_corpora(), selected=0) #Here, I'd like to update the values
Feature Request
Context
I have a GUI containing an
Option
box where options can be added or removed while running.Expected Behaviour
When setting, if the
value
contains a string, it represents the item to select. If thevalue
is a list, it should change the values.Actual Behaviour
When setting, the
value
should contain the item to select.Sample code, demonstrating the issue