Py.Cafe

maartenbreddels/

glue-jupyter

Solara Interaction Playground

DocsPricing
  • app.py
  • fast_histogram-0.14-cp39-abi3-pyodide_2024_0_wasm32.whl
  • glfw-2.9.0-py3-none-any.whl
  • glue_jupyter-0.10.2.dev520+gafac49aed-py3-none-any.whl
  • requirements.txt
  • vispy-0.15.2-cp312-cp312-pyodide_2024_0_wasm32.whl
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# check out https://solara.dev/ for documentation
# or https://github.com/widgetti/solara/
# And check out https://py.cafe/maartenbreddels for more examples
import solara

# reactive variables will trigger a component rerender
# when changed.
# When you change the default (now 0), hit the embedded browser
# refresh button to reset the state
clicks = solara.reactive(0)


@solara.component
def Page():
    print("The component render function gets called")
    # change this code, and see the output refresh
    color = "green"
    if clicks.value >= 5:
        color = "red"

    def increment():
        clicks.value += 1
        print("clicks", clicks)  # noqa

    solara.Button(label=f"Clicked: {clicks}", on_click=increment, color=color)


# Solara also supports ipywidgets
# remove the Page component and assign an ipywidget to
# the page variable, e.g.
# page = mywidget
requirements.txt
1
2
3
4
5
solara
fast_histogram@https://py.cafe/files/maartenbreddels/glue-jupyter/fast_histogram-0.14-cp39-abi3-pyodide_2024_0_wasm32.whl
glue-jupyter@https://py.cafe/files/maartenbreddels/glue-jupyter/glue_jupyter-0.10.2.dev520+gafac49aed-py3-none-any.whl