sagecell icon indicating copy to clipboard operation
sagecell copied to clipboard

interact implementation doesn't seem to have nrows for buttons

Open kcrisman opened this issue 4 years ago • 5 comments

nrows doesn't seem to do anything here:

@interact
def _(a=selector(buttons=True, nrows=3, values=[1..100], default=1)):
    print(a)

kcrisman avatar Jun 02 '20 22:06 kcrisman

The code insists on nrows dividing the number of entries, with 1..99 it works. So the question is whether this behaviour should be changed.

novoselt avatar Jun 05 '20 04:06 novoselt

Well, that is not in any of the several sources for documentation I found, so it presumably is a change (the examples on the Sage wiki even have screen shots?)

    * ``u = selector(values, label=None, nrows=None, ncols=None,
      buttons=False)`` - a dropdown menu or buttons (get buttons
      if ``nrows``, ``ncols``, or ``buttons`` is set, otherwise a
      dropdown menu)

or

        - ``nrows`` - an integer (default: None); if given determines
          the number of rows of buttons; if given buttons option below
          is set to True

kcrisman avatar Jun 05 '20 15:06 kcrisman

Sometime next week I hope to have a more stable document available, by the way - but the documentation that exists in various places is all pretty similar, it's just a matter of actually implementing that API in a few ways that changed because of Python or other changes.

kcrisman avatar Jun 05 '20 15:06 kcrisman

There are explicit checks for clean divisibility: https://github.com/sagemath/sagecell/blob/master/interact_sagecell.py#L768 This is not written by me, so they have been in place for at least 6 years. Dropping them off leads to errors in JavaScript as apparently those controls can't handle such cases. Trying your example in CoCalc - it works well, while Jupyter seems to completely ignore nrows no matter if division is clean or not.

novoselt avatar Jun 05 '20 21:06 novoselt

There are explicit checks for clean divisibility: https://github.com/sagemath/sagecell/blob/master/interact_sagecell.py#L768 This is not written by me, so they have been in place for at least 6 years. Dropping them off leads to errors in JavaScript as apparently those controls can't handle such cases.

That's unfortunate. I would say to leave this issue open, then, but obviously it's not worth trying to dig deeper this instant.

Trying your example in CoCalc - it works well, while Jupyter seems to completely ignore nrows no matter if division is clean or not.

That's not surprising, but definitely useful info.

kcrisman avatar Jun 06 '20 00:06 kcrisman