sagemath / sagecell

The Sage Cell Server---providing a way to embed Sage computations into any web page.
Other
201 stars 70 forks source link

interact implementation doesn't seem to have nrows for buttons #534

Open kcrisman opened 4 years ago

kcrisman commented 4 years ago

nrows doesn't seem to do anything here:

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

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.

kcrisman commented 4 years ago

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 commented 4 years ago

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.

novoselt commented 4 years ago

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.

kcrisman commented 4 years ago

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.