I'm attempting to create a class to easily create and generate jupyter widgets for dashboards in my notebooks. This class so far has an add_row and display method. I'm having trouble finding a way to easily pass parameters to the widget object as different widgets require different things (instead of using a 100 if statements for each widget). It works fine for TextBox at the moment but I want to extend it to get it to work with all widgets.
Here's a sample of the add_row method:
# types: Type of widgets ex: ['Text', 'Text', 'Text']
# labels: Label names ['A', 'B', 'C']
# values: Default values ['', '', '']
for i in range(len(labels)):
w = getattr(widgets, types[i])
row.append(w(description=labels[i], value=values[i]))
self.rows.append(widgets.HBox(row))