magicgui.widgets

These are the main Widgets provided by magicgui.

While the primary API is to use the @magicgui decorator, one can also instantiate widgets directly using any of these objects.

The create_widget() function is a helper function that will auto-pick and instantiate the appropriate widget subclass given the arguments (type, annotation) to the function.

Functions

create_widget

Create and return appropriate widget subclass.

Value Widgets

Label

A non-editable text display.

LineEdit

A one-line text editor.

LiteralEvalLineEdit

A one-line text editor that evaluates strings as python literals.

TextEdit

A widget to edit and display both plain and rich text.

FileEdit

A LineEdit widget with a button that opens a FileDialog.

RangeEdit

A widget to represent a python range object, with start/stop/step.

SliceEdit

A widget to represent range objects, with start/stop/step.

DateTimeEdit

A widget for editing dates and times.

DateEdit

A widget for editing dates.

TimeEdit

A widget for editing times.

Button Widgets

PushButton

A clickable command button.

CheckBox

A checkbox with a text label.

RadioButton

A radio button with a text label.

Ranged Widgets

SpinBox

A widget to edit an integer with clickable up/down arrows.

FloatSpinBox

A widget to edit a float with clickable up/down arrows.

Slider Widgets

Slider

A slider widget to adjust an integer value within a range.

FloatSlider

A slider widget to adjust an integer value within a range.

LogSlider

A slider widget to adjust a numerical value logarithmically within a range.

ProgressBar

A progress bar widget.

Categorical Widgets

ComboBox

A dropdown menu, allowing selection between multiple choices.

Select

A list of options, allowing selection between multiple choices.

RadioButtons

An exclusive group of radio buttons, providing a choice from multiple choices.

Container Widgets

Container

A Widget to contain other widgets.

FunctionGui

Wrapper for a container of widgets representing a callable object.