1 | initial version |
An example what you can do to get something like an action button:
status = False
def toggle():
global status
status = not status
@interact
def _(action=[toggle]):
action()
print status
A second example ( putting 'random_number' as string in the selector list creates a labeled button)
def random_number():
return random()
@interact
def _(action=selector(['random_number'],buttons=True)):
action = eval(action)
print action()