-
-
Notifications
You must be signed in to change notification settings - Fork 75
Open
Description
There is multiple errors with the controls argument of @interact.
To use it, the decorated function must have a **kargs argument so it can pass the controls.
@interact(controls=[("b",Button("a"))])
def f(**kargs):
passThis code throw an error because it try to pass the proxy to kargs, because it's the first argument of f and doesn't have a default value. But in this case f doesn't take any positional argument :
TypeError: f() takes 0 positional arguments but 1 was givenI can resolve it by adding any argument before **kargs (any control or an argument for the proxy):
@interact(controls=[("b",Button("a"))])
def f(proxy, **kargs):
passIn this case, it doesn't throw any error but sagecell add an input control with label kargs

For now I just do this:
@interact(controls=[("b",Button("AA"))])
def f(proxy,**kargs):
if getattr(proxy,"kargs"):
del proxy.kargsMetadata
Metadata
Assignees
Labels
No labels