get_widget_class

magicgui.type_map.get_widget_class(value=None, annotation=None, options=None, is_result=False)[source]

Return a WidgetClass appropriate for the given parameters.

Parameters
  • value (Any, optional) – A python value. Will be used to determine the widget type if an annotation is not explicitly provided by default None

  • annotation (Optional[Type], optional) – A type annotation, by default None

  • options (WidgetOptions, optional) – Options to pass when constructing the widget, by default {}

  • is_result (bool, optional) – Identifies whether the returned widget should be tailored to an input or to an output.

Returns

The WidgetClass, and WidgetOptions that can be used for params. WidgetOptions may be different than the options passed in.

Return type

Tuple[WidgetClass, WidgetOptions]