I want to make an interaction with an ipywidgets Dropdown which goes on to create a barchart. The bars of the barchart can be ordered in different ways.
I have an enum of the types of sorting I wish to give as options:
class SORT_TYPE(Enum):
ALPHABETICAL = 1
ASCENDING = 2
DESCENDING = 3
UNSORTED = 4
I have a dropdown widget where the values use the enum above
ordering_dropdown = widgets.Dropdown(
options={'Alphabetical': SORT_TYPE.ALPHABETICAL, \
'Ascending': SORT_TYPE.ASCENDING, \
'Descending': SORT_TYPE.DESCENDING, \
'Unsorted': SORT_TYPE.UNSORTED},
value=SORT_TYPE.ALPHABETICAL,
description='Ordering: ',
)
But when I go to use it in an interaction
interactive(my_func, p1=p1, p2=p2, ordering=ordering_dropdown)
I get
ValueError: <SORT_TYPE.ALPHABETICAL: 1> cannot be transformed to a widget
Do you know what I'm doing wrong?
Thanks in advance.