Leaving the slider value editable

asked 2017-09-03 01:47:13 +0200

Bill Cook gravatar image

updated 2017-09-03 14:49:32 +0200

I would like to have a slider with an optional editable value. I have found that the first version gives me that option but the second just prints the value of "h" to the right (I can't click on it and edit it - it must be changed by messing with the slider).

def _(h=(0.1,(-1,1))):

def _(h=slider(-1,1,default=0.1,step_size=0.001,label='$h=$')):

I would just use the first block of code except that then I cannot give it a nicely formatted label or adjust other attributes (like step size).


Edit: I am running Windows 10. Using both Chrome and Microsoft Edge, I have the same issue. The first slider allows me to click on and edit the h value on the right while the second just displays the h value to the right. Here's the full html file I'm using to load up the interact...

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width">
    <script src="https://sagecell.sagemath.org/static/embedded_sagecell.js"></script>
    <script>$(function () {
    sagecell.makeSagecell({inputLocation:  '#mycell',
                           template:       sagecell.templates.minimal,
                           autoeval:       true,
                           linked:         true,
                           hide:           ["evalButton"]
                           //evalButtonText: 'Recompute'


<div id="mycell"><script type="text/x-sage">
def _(h=(0.1,(-1,1))):

def _(h=slider(-1,1,default=0.1,step_size=0.001,label='$h=$')):

edit retag flag offensive close merge delete


Seems strange. Both versions worked for me in sagecell, cocalc and my local SageMath v8.0 (via both notebooks: classic and jupyter). Could this be a browser issue? Perhaps providing some more info could be helpful. Eg. SageMath version and browser.

fidbc gravatar imagefidbc ( 2017-09-03 08:24:14 +0200 )edit

I just edited my question adding in the html code to load the interact. I am using Chrome in Windows 10 (although Microsoft Edge does the same thing - and it's behaved the same way on other machines).

Bill Cook gravatar imageBill Cook ( 2017-09-03 14:50:41 +0200 )edit

Also, I posted a copy of this to my webpage...


Bill Cook gravatar imageBill Cook ( 2017-09-03 14:51:55 +0200 )edit

Sorry, was not understanding the question at all. Hadn't realized there is a spinner at the far right! Now that the question is clear, the behaviour seems to be inconsistent throughout the distinct interfaces (cocalc notebooks, sagecell and SageMath notebooks). Do you intend to use this via sagecell as in your example?

fidbc gravatar imagefidbc ( 2017-09-04 03:48:27 +0200 )edit

Yes. I've been making webpages for my calc 1 class to explore various ideas.

Bill Cook gravatar imageBill Cook ( 2017-09-04 04:40:50 +0200 )edit