Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
kcrisman opened this issue Jun 2, 2020 · 5 comments
Open

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

kcrisman opened this issue Jun 2, 2020 · 5 comments

Comments

@kcrisman
Copy link
Member

kcrisman commented Jun 2, 2020

nrows doesn't seem to do anything here:

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

novoselt commented Jun 5, 2020

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
Copy link
Member Author

kcrisman commented Jun 5, 2020

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
Copy link
Member Author

kcrisman commented Jun 5, 2020

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
Copy link
Member

novoselt commented Jun 5, 2020

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
Copy link
Member Author

kcrisman commented Jun 6, 2020 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants