magicgui
magicgui copied to clipboard
Add 'ComboBox.current_index' attribute
Hi, thanks for making magicgui! It's a very cool project and super useful for quickly making widgets / guis.
At the minute, if I would like to get the current index selected in a ComboBox, I either do something like this:
current_name = container.combobox.current_choice
current_index = container.combobox.choices.index(current_name)
or access the QComboBox directly:
container.combobox._widget._qwidget.currentIndex()
Is there a simpler way to do this? Or would it be possible to add a ComboBox.current_index property? I'd be happy to submit a pr if you'd like this added.
Thanks again!
Hi @p-j-smith, sorry for the delay. That would be a great addition thank you. I think it could be added in magicgui/widgets/bases/_categorical_widget.py. Let me know if you run into any issues