Get button state from on_click, on_change outside of the callback

hey there,

I have a bunch of buttons defining the value of a variable, that I want to use as a parameter to an sql query. So if button state is equal 2019, the query will set the value of a variable to 2019.

If I understand correctly, I can run my query within the callback function that I pass to the on_click or on_event. The new argument would capture that. I was wondering if there is a way to get these values returned, so that I could run my query outside of the callback function. For example, by accessing the myobj._property_values["active"]…

thanks in advance…

ok, this seems to be doing what I need…

As long as the objects are in some accessible scope, you can just reference them like any Python variable. See e.g. the callback referencing all the sliders here:

1 Like

thx bryan,

I was defining them as static methods and ended up in a deadend…