I have a Combo Box in which I need to update item values dynamically.
Currently using the following code:
def __init__(self, *args, **kwargs):
super().__init__('Report')
self._partNumber = ControlText(label= 'Part Number')
self._shellSize = ControlCombo(label= 'Shell Size')
self._partNumber.changed_event = self.__partNumberChanged
def __partNumberChanged(self):
self._shellSize.clear()
v = 25 if self._partNumber.value[-3:] == '805' else 50
opts = [('5-13', 25), ('14', 40), ('15', v), ('16', 40), ('17', 50), ('18', 30), ('19', 50), ('21,23', 80)]
for item in opts:
self._shellSize += item
When combo items are printed every option shows up:
>> print(self._shellSize.items)
dict_items([('5-13', 25), ('14', 40), ('15', 25), ('16', 40), ('17', 50), ('18', 30), ('19', 50), ('21,23', 80)])
But form won't display all of them:
Is there a way to refresh a control or update an item value? Any idea why this doesn't work properly?
Thanks!
Pyforms won't allow duplicated values, I had to modify
control_combo.py
underpyforms_gui/controls/
Now you can call it like this: