Skip to content

magicgui.magic_factory#

magicgui.magic_factory = TypeMap.global_instance().magic_factory module-attribute #

magicgui.type_map._magicgui.MagicFactory #

Bases: partial, Generic[_FGuiVar]

Factory function that returns a FunctionGui instance.

While this can be used directly, (see example below) the preferred usage is via the magicgui.magic_factory decorator.

Examples:

>>> def func(x: int, y: str):
...     pass
>>> factory = MagicFactory(function=func, labels=False)
>>> # factory accepts all the same arguments as magicgui()
>>> widget1 = factory(call_button=True)
>>> # can also override magic_kwargs that were provided when creating the factory
>>> widget2 = factory(auto_call=True, labels=True)

__name__: str property #

Pass function name.

__call__(*args, **kwargs) #

Call the wrapped _magicgui and return a FunctionGui.

__getattr__(name) #

Allow accessing FunctionGui attributes without mypy error.

__new__(function, *args, magic_class=FunctionGui, widget_init=None, type_map=None, **keywords) #

Create new MagicFactory.

__repr__() #

Return string repr.