ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Thu, 08 Oct 2020 22:40:27 +0200row of multiple selection checkboxeshttps://ask.sagemath.org/question/53609/row-of-multiple-selection-checkboxes/ I would like to have the multiple selection checkboxes below in a row instead of a column. I did search around and didn't come up with anything obvious. As well as knowing how to do it; what resource should I have looked at?
I am putting together anatomical diagrams of the Kerr_Schild metric.
@interact def _(red_ring =('red ring', True),
black_ring =('black ring',False),
green_ring = ('green ring',False)
):
a = sphere((1,0,0),0.2)
if red_ring:
a += circle((0,0,0), 2, color='red', thickness=6)
if black_ring:
a += circle((0,0,0), .4, color='black', thickness=6)
if green_ring:
a += circle((0,0,0), .7, color='green', thickness=6)
show(a,viewer='threejs')
Sat, 26 Sep 2020 16:08:36 +0200https://ask.sagemath.org/question/53609/row-of-multiple-selection-checkboxes/Answer by rrogers for <p>I would like to have the multiple selection checkboxes below in a row instead of a column. I did search around and didn't come up with anything obvious. As well as knowing how to do it; what resource should I have looked at? <br>
I am putting together anatomical diagrams of the Kerr_Schild metric.</p>
<pre><code>@interact def _(red_ring =('red ring', True),
black_ring =('black ring',False),
green_ring = ('green ring',False)
):
a = sphere((1,0,0),0.2)
if red_ring:
a += circle((0,0,0), 2, color='red', thickness=6)
if black_ring:
a += circle((0,0,0), .4, color='black', thickness=6)
if green_ring:
a += circle((0,0,0), .7, color='green', thickness=6)
show(a,viewer='threejs')
</code></pre>
https://ask.sagemath.org/question/53609/row-of-multiple-selection-checkboxes/?answer=53791#post-id-53791This format works but I am having a small problem with "f()" argument passing, I can't seem to make it a dummy argument. The ipywidgets page that has instructions and examples is:
https://www.kaggle.com/atorabi/intro-to-ipywidgets
import ipywidgets
red_ring =ipywidgets.Checkbox(True,description='red ring')
black_ring =ipywidgets.Checkbox(True,description='black ring')
green_ring =ipywidgets.Checkbox(True,description='green ring')
ui = ipywidgets.HBox([red_ring,black_ring,green_ring])
def f(red_ring,black_ring,green_ring):
a = sphere((1,0,0),0.2)
if red_ring:
a += circle((0,0,0), 2, color='red', thickness=6)
if black_ring:
a += circle((0,0,0), .4, color='black', thickness=6)
if green_ring:
a += circle((0,0,0), .7, color='green', thickness=6)
show(a,viewer='threejs')
out = ipywidgets.interactive_output(f, {'red_ring': red_ring,
'black_ring': black_ring,
'green_ring': green_ring})
display(ui, out)Thu, 08 Oct 2020 22:40:27 +0200https://ask.sagemath.org/question/53609/row-of-multiple-selection-checkboxes/?answer=53791#post-id-53791