Mateja
Mateja
Mmarimo
Created by Mateja on 5/30/2024 in #archived-help-and-support
I'm having a lot of trouble with placing
Would you like me to submit an issue for this in the repo?
22 replies
Mmarimo
Created by Mateja on 5/30/2024 in #archived-help-and-support
I'm having a lot of trouble with placing
Oh I see, lazy wraps the callable, not the accordion, got it. Thanks!
22 replies
Mmarimo
Created by Mateja on 5/30/2024 in #archived-help-and-support
I'm having a lot of trouble with placing
Now that I think about it, if mo.lazy is a wrapper around accordion, then accordion can't pass args to its own wrapper ...
22 replies
Mmarimo
Created by Mateja on 5/30/2024 in #archived-help-and-support
I'm having a lot of trouble with placing
One more thing about accordion: The docs say. [lazy] is a convenience that wraps each accordion in a mo.lazy component. mo.lazy takes an arg show_loading_indicator. Would it make sense to add the show_loading_indicator to accordion have have it pass through to mo.lazy?
22 replies
Mmarimo
Created by Mateja on 5/30/2024 in #archived-help-and-support
I'm having a lot of trouble with placing
Yeah, makes sense
22 replies
Mmarimo
Created by Mateja on 5/30/2024 in #archived-help-and-support
I'm having a lot of trouble with placing
Curious to know if it only affects buttons or all UIElements, I haven't tried
22 replies
Mmarimo
Created by Mateja on 5/30/2024 in #archived-help-and-support
I'm having a lot of trouble with placing
Thanks, still trying to wrap my head around the globals thing. I keep repeating, "think Excel, think Excel ..."
22 replies
Mmarimo
Created by Mateja on 5/30/2024 in #archived-help-and-support
I'm having a lot of trouble with placing
Is this an issue with _clone?
22 replies
Mmarimo
Created by Mateja on 5/30/2024 in #archived-help-and-support
I'm having a lot of trouble with placing
Thank you @Myles Scolnick !
22 replies
Mmarimo
Created by Mateja on 5/30/2024 in #archived-help-and-support
I'm having a lot of trouble with placing
Would this work in the mean time?
import marimo as mo
from functools import partial

buttons = []


def an_expensive_function(idx):
global buttons
button = mo.ui.button(
label="My Awesome Button", on_click=lambda _: print(f"Button {idx} Pushed")
)
buttons.append(button)
return button


mo.accordion(
{
"Reveal Button {idx}": partial(an_expensive_function, idx=idx)
for idx in range(10)
},
lazy=True,
)
import marimo as mo
from functools import partial

buttons = []


def an_expensive_function(idx):
global buttons
button = mo.ui.button(
label="My Awesome Button", on_click=lambda _: print(f"Button {idx} Pushed")
)
buttons.append(button)
return button


mo.accordion(
{
"Reveal Button {idx}": partial(an_expensive_function, idx=idx)
for idx in range(10)
},
lazy=True,
)
22 replies
Mmarimo
Created by Mateja on 5/30/2024 in #archived-help-and-support
I'm having a lot of trouble with placing
So my actual code looks more like:
import marimo as mo
from functools import partial


def an_expensive_function(idx):
return mo.ui.button(
label="My Awesome Button", on_click=lambda _: print(f"Button {idx} Pushed")
)


mo.accordion(
{
"Reveal Button {idx}": partial(an_expensive_function, idx=idx)
for idx in range(10)
},
lazy=True,
)
import marimo as mo
from functools import partial


def an_expensive_function(idx):
return mo.ui.button(
label="My Awesome Button", on_click=lambda _: print(f"Button {idx} Pushed")
)


mo.accordion(
{
"Reveal Button {idx}": partial(an_expensive_function, idx=idx)
for idx in range(10)
},
lazy=True,
)
because I don't know how many buttons I'll need before the cell runs (10 for the sake of example, but it's variable)
22 replies
Mmarimo
Created by Mateja on 5/28/2024 in #archived-help-and-support
Is there a way to pass a config
Got it, thanks!
2 replies