Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

This format works but I am having a small problem with "f()" argument passing, I can't seem to make it a dummy argument:

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)enter code here

This format works but I am having a small problem with "f()" argument passing, I can't seem to make it a dummy argument:

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)enter code here
out)

This format works but I am having a small problem with "f()" argument passing, I can't seem to make it a dummy argument: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)