I am writing an extension and have a combobox ui that I want to update its contents. Any idea how can I access the options and overwrite them? Which methods should I use?
You can apply something like the following
combo_box = ui.ComboBox(...).model
...
# clean combo box
for item in combo_box.get_item_children():
combo_box.remove_item(item)
...
# fill combo box
for value in ["a", "b", "c"]:
combo_box.append_child_item(None, ui.SimpleStringModel(value))
...
# change selected value
combo_box.get_item_value_model().set_value(ELEMENT_INDEX)
Thank you so much!
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.