Ticket #8761 (new enhancement)
Opened 3 years ago
sage notebook: make a new interact control (like selector) that really works like a button
| Reported by: | was | Owned by: | jason, was |
|---|---|---|---|
| Priority: | minor | Milestone: | sage-5.10 |
| Component: | notebook | Keywords: | |
| Cc: | Work issues: | ||
| Report Upstream: | N/A | Reviewers: | |
| Authors: | Merged in: | ||
| Dependencies: | Stopgaps: |
Description
First, see this screenshot:
Now imagine that when you push either of the buttons, the interact is triggered and the button comes back up (it does not get *stuck* down as a selector).
When the interact triggers calling of the function, if this is triggered by a button being clicked then the corresponding variable is set to the value of that button (usually the text label). Otherwise, the variable is set to None. Then interact applications can tell if a button being pushed triggered the function being called based on whether or not the variable is None.
@interact
def f(X = button(['Ok', 'Cancel', "Continue"])):
print X
Notice that button is much like selector with buttons=True...
