In [1]:
widget = calico.FloatSliderWidget()
calico.display(widget)
In [2]:
widget.value
Out[2]:
0
In [3]:
x = 0
def test(a, b):
    global x
    x = b
    print(a, b)

widget.on_value_change(test, "value")
In [4]:
x
Out[4]:
0
In [5]:
print(x)
0
In [6]:
[x for x in dir(calico) if x.endswith("Widget") and x.startswith("make")]
Out[6]:
['makeAccordionWidget', 'makeBoundedFloatTextWidget', 'makeBoundedIntTextWidget', 'makeButtonWidget', 'makeCameraWidget', 'makeCheckboxWidget', 'makeContainerWidget', 'makeDropdownWidget', 'makeFloatProgressWidget', 'makeFloatSliderWidget', 'makeFloatTextWidget', 'makeHTMLWidget', 'makeImageWidget', 'makeIntProgressWidget', 'makeIntSliderWidget', 'makeIntTextWidget', 'makeLatexWidget', 'makePasswordWidget', 'makePopupWidget', 'makeRadioButtonsWidget', 'makeSelectWidget', 'makeTabWidget', 'makeTextWidget', 'makeTextareaWidget', 'makeToggleButtonWidget', 'makeToggleButtonsWidget']
In [7]:
button = calico.ButtonWidget()
calico.display(button)
In [8]:
button.description = "Press me!"
In [9]:
button.on_click(lambda obj: print("Ouch!"))
In [10]:
import time
for s in "This is a test".split():
    button.description = s
    time.sleep(1)
In [11]:
checkbox = calico.CheckboxWidget(description="I like food")
calico.display(checkbox)
In [12]:
checkbox.value
Out[12]:
False
In [13]:
checkbox.value = True
In [14]:
checkbox.on_value_change(lambda value_name, new_value: print(value_name, new_value), "value")
In [14]:
fpw = calico.FloatProgressWidget()
calico.display(fpw)
In [15]:
fpw.value = 50
In [16]:
fpw.description = "Float Progress Widget"
In [17]:
widgets = [x for x in dir(calico) if x.endswith("Widget") and x.startswith("make")]
In [18]:
w = []
for widget in widgets:
    print("making", widget, "...")
    w.append(getattr(calico, widget)())
    try:
        w[-1].description = w[-1].__class__.__name__
    except:
        print("Fail:", dir(w[-1]))
for widget in w:
    print(widget)
    calico.display(widget)
making makeAccordionWidget ...
making makeBoundedFloatTextWidget ...
making makeBoundedIntTextWidget ...
making makeButtonWidget ...
making makeCameraWidget ...
making makeCheckboxWidget ...
making makeContainerWidget ...
making makeDropdownWidget ...
making makeFloatProgressWidget ...
making makeFloatSliderWidget ...
making makeFloatTextWidget ...
making makeHTMLWidget ...
making makeImageWidget ...
making makeIntProgressWidget ...
making makeIntSliderWidget ...
making makeIntTextWidget ...
making makeLatexWidget ...
making makePasswordWidget ...
making makePopupWidget ...
making makeRadioButtonsWidget ...
making makeSelectWidget ...
making makeTabWidget ...
making makeTextWidget ...
making makeTextareaWidget ...
making makeToggleButtonWidget ...
making makeToggleButtonsWidget ...
<Widgets+AccordionWidget object at 0x000000000000002B [Widgets+AccordionWidget]>
<Widgets+BoundedFloatTextWidget object at 0x000000000000002C [Widgets+BoundedFloatTextWidget]>
<Widgets+BoundedIntTextWidget object at 0x000000000000002D [Widgets+BoundedIntTextWidget]>
<Widgets+ButtonWidget object at 0x000000000000002E [Widgets+ButtonWidget]>
<Widgets+CameraWidget object at 0x000000000000002F [Widgets+CameraWidget]>
<Widgets+CheckboxWidget object at 0x0000000000000030 [Widgets+CheckboxWidget]>
<Widgets+ContainerWidget object at 0x0000000000000031 [Widgets+ContainerWidget]>
<Widgets+DropdownWidget object at 0x0000000000000032 [Widgets+DropdownWidget]>
<Widgets+FloatProgressWidget object at 0x0000000000000033 [Widgets+FloatProgressWidget]>
<Widgets+FloatSliderWidget object at 0x0000000000000034 [Widgets+FloatSliderWidget]>
<Widgets+FloatTextWidget object at 0x0000000000000035 [Widgets+FloatTextWidget]>
<Widgets+HTMLWidget object at 0x0000000000000036 [Widgets+HTMLWidget]>
<Widgets+ImageWidget object at 0x0000000000000037 [Widgets+ImageWidget]>
<Widgets+IntProgressWidget object at 0x0000000000000038 [Widgets+IntProgressWidget]>
<Widgets+IntSliderWidget object at 0x0000000000000039 [Widgets+IntSliderWidget]>
<Widgets+IntTextWidget object at 0x000000000000003A [Widgets+IntTextWidget]>
<Widgets+LatexWidget object at 0x000000000000003B [Widgets+LatexWidget]>
<Widgets+PasswordWidget object at 0x000000000000003C [Widgets+PasswordWidget]>
<Widgets+PopupWidget object at 0x000000000000003D [Widgets+PopupWidget]>
<Widgets+RadioButtonsWidget object at 0x000000000000003E [Widgets+RadioButtonsWidget]>
<Widgets+SelectWidget object at 0x000000000000003F [Widgets+SelectWidget]>
<Widgets+TabWidget object at 0x0000000000000040 [Widgets+TabWidget]>
<Widgets+TextWidget object at 0x0000000000000041 [Widgets+TextWidget]>
<Widgets+TextareaWidget object at 0x0000000000000042 [Widgets+TextareaWidget]>
<Widgets+ToggleButtonWidget object at 0x0000000000000043 [Widgets+ToggleButtonWidget]>
<Widgets+ToggleButtonsWidget object at 0x0000000000000044 [Widgets+ToggleButtonsWidget]>
In [20]:
t = calico.Table([["Doug", 1, 2, 3], ["Keith", 4, 5, 6], ["Stephanie", 7, 8, 9]])
t
Out[20]:
Item1Item2Item3Item4
Doug123
Keith456
Stephanie789
In [20]:
t
Out[20]:
Item1Item2Item3Item4
Doug123
Keith456
Stephanie789
In [22]:
calico.display(t)
Item1Item2Item3Item4
Doug123
Keith456
Stephanie789
In [23]:
_
Out[23]:
Item1Item2Item3Item4
Doug123
Keith456
Stephanie789
In [24]:
print = calico.display
In [21]:
t = calico.Table([["Doug", 1, 2, 3], ["Keith", 4, 5, 6], ["Stephanie", 7, 8, 9]])
t
Out[21]:
Item1Item2Item3Item4
Doug123
Keith456
Stephanie789
In [22]:
calico.display(t)
Item1Item2Item3Item4
Doug123
Keith456
Stephanie789
In [23]:
print = calico.display
In [24]:
print(1)
1
In [25]:
print(t)
Item1Item2Item3Item4
Doug123
Keith456
Stephanie789
In [26]:
t
Out[26]:
Item1Item2Item3Item4
Doug123
Keith456
Stephanie789
In [27]:
print(1)
1
In [31]:
%%lang scheme
(calico.display t)
Item1Item2Item3Item4
Doug123
Keith456
Stephanie789
Out[31]:
<void>
In [32]:
pw = calico.makePasswordWidget()
calico.display(pw)

def f(obj):
    print(obj.value, "submitted!")
    
pw.on_submit(f)
In [33]:
print(pw.value)
print(pw._view_name)

PasswordView
In [34]:
calico.makeContainerWidget()
In [35]:
import Widgets
import ZMQServer
In [36]:
b = calico.ButtonWidget("Button")
widget = Widgets.ContainerWidget(ZMQServer.session, children=[b])
In [37]:
widget
In [38]:
b2 = calico.ButtonWidget("Button 2")
In [39]:
widget.AddChild(b2)
In [ ]: