S
Solara

general

Thank you for your answer but next

Cchristian543210/6/2023
Thank you for your answer, but next question, why display(button) from widget on solara component doesn' t appear on my codes: import solara import ipywidgets as widgets github_url = solara.util.github_url(file) some app state that outlives a single page app_state = solara.reactive(0) clicks = 0 def on_click(button): global clicks clicks += 1 button.description = f"Clicked {clicks} times" button = widgets.Button(description="Clicked 0 times") button.on_click(on_click) @solara.component def Page(): with solara.Sidebar(): solara.Button(label="Juristech", attributes={"href": "https://www.google.com/", "target": "_blank"}, text=True, outlined=True) solara.Markdown("") solara.Button(label="Surveyour Optimization", attributes={"href": "https://www.google.com/", "target": "_blank"}, text=True, outlined=True) with solara.Card("Project Juristech"): solara.Markdown("Grafik Juristech:") display(button)
@solara.component def Layout(children): return solara.AppLayout(children=children)
MMaartenBreddels10/6/2023
import solara
import ipywidgets as widgets

app_state = solara.reactive(0)


@solara.component
def Page():
with solara.Sidebar():
solara.Button(label="Juristech", attributes={"href": "https://www.google.com/", "target": "_blank"}, text=True, outlined=True)
solara.Markdown("")
solara.Button(label="Surveyour Optimization", attributes={"href": "https://www.google.com/", "target": "_blank"}, text=True, outlined=True)
clicks = 0

def on_click(button):
nonlocal clicks
clicks += 1
button.description = f"Clicked {clicks} times"

button = widgets.Button(description="Clicked 0 times")
button.on_click(on_click)

display(button)
with solara.Card("Project Juristech"):
solara.Markdown("Grafik Juristech:")


@solara.component
def Layout(children):
return solara.AppLayout(children=children)
import solara
import ipywidgets as widgets

app_state = solara.reactive(0)


@solara.component
def Page():
with solara.Sidebar():
solara.Button(label="Juristech", attributes={"href": "https://www.google.com/", "target": "_blank"}, text=True, outlined=True)
solara.Markdown("")
solara.Button(label="Surveyour Optimization", attributes={"href": "https://www.google.com/", "target": "_blank"}, text=True, outlined=True)
clicks = 0

def on_click(button):
nonlocal clicks
clicks += 1
button.description = f"Clicked {clicks} times"

button = widgets.Button(description="Clicked 0 times")
button.on_click(on_click)

display(button)
with solara.Card("Project Juristech"):
solara.Markdown("Grafik Juristech:")


@solara.component
def Layout(children):
return solara.AppLayout(children=children)
You need to create a new widget for each browser page, so if you put it in the Page component, it will work

Looking for more? Join the community!