Accessing throttled value in a Parameterized class

Hello,

I’m wondering how to use the throttled value of a widget with a parameterized class,
or specify the throttling period when DateRange is created declaratively.
i,e

class DateRange(param.Parameterized):
     date_range = param.DateRange(...)

here, date_range does not accept a callback_throttle keyword like the DateRange widget does.

Furthermore, how should I use @pn.depends(...) decorator for a function that should respond to the throttled value?

TIA,
Joy

There’s currently not a great approach here but there’s already an issue about this you could track (or contribute to): https://github.com/holoviz/panel/issues/1259

Thanks @philippjfr, and sorry for the delayed reply. I think I’ll just use explicit
widget instances for now.

I’m having the exact same issue…
@JoyMonteiro Would you mind sharing your workaround for this?
@philippjfr In the Issue you mention, it seems to me that a solution for panel.depends is suggested, but will that also help for the param.depends decorator?

@marfel sorry for the delayed reply.

I essentially created a class attribute initialized to None. In the object init, I assign an
explicit widget

class WordCloud(param.Parameterized):
    '''
    the word cloud app
    '''

    wordcloud_date_range = None

    def __init__(self):

        self.wordcloud_date_range = pnw.DateRangeSlider(
            name='Choose time period',
            start=DATA_STORE.start_time,
            end=DATA_STORE.end_time,
            value_throttled=(DATA_STORE.start_time, DATA_STORE.end_time),
            callback_throttle=1000)

        super().__init__()

and then use this in the decorator

@pn.depends('wordcloud_date_range.value_throttled')
    def create_wordcloud(self):

Ahh, I see. So despite this being a parameterized class, you’re not using the param magic but panel's dependency handling. And why not? Thank you!