WindmillWWindmill
Powered by
Joldz 🔮J
Windmill•2y ago•
4 replies
Joldz 🔮

Not understanding how to use setValue control for a Toggle

I am having difficulties understanding how to set a toggle as true or false from a Python script. I was trying to have it be tied to another component's (lets call it x) result when I hit a button but it only reevaluates the toggle when the result of x has changed, not anytime that it runs or the button is pressed.

So I started to learn about the setValue control for toggles as a possible solution for this but am unsure how to reference that control and everything I need to import to make this work. Do I have to use javascript instead of Python? If not what besides "import setValue from windmill" should I have imported?

i see that this is the proper syntax for it:
setValue(id: string, value: any)
setValue(id: string, value: any)

but the "value" and "any" part is a bit vague. So for example to set a toggle to false would i type the follwoing?
--assuming toggle id is 'a'
import setValue from windmill
setValue('a', defaultValueEval(False)
--assuming toggle id is 'a'
import setValue from windmill
setValue('a', defaultValueEval(False)


bc when I do I get the following error
 import bin, browser, server, conf, tools, sys
ModuleNotFoundError: No module named 'browser
 import bin, browser, server, conf, tools, sys
ModuleNotFoundError: No module named 'browser
'
Do I really need to import all of those as well to use the setValue control?

Any help would be appreciated. If you need anymore information let me know.
WindmillJoin
3,362Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements
Recent Announcements
henri-c

Weekly kenote to tell you about our latest updates https://discord.com/channels/930051556043276338/1278977038430240813 https://youtube.com/live/2dGd9TdT8xs?feature=share

henri-c · 4d ago

Pyra

### HTTP tracing (EE) Capture HTTP requests made by job scripts as observability spans Features: - View HTTP request traces (method, URL, status, timing) in the job details UI - Auto-instrumentation for Native TypeScript, MITM proxy for other languages - Integrates with external OpenTelemetry collectors changelog: https://www.windmill.dev/changelog/http-tracing docs: https://www.windmill.dev/docs/advanced/instance_settings#http-tracing Additionally jobs memory metrics are now fully OSS!

Pyra · 2w ago

henri-c

First keynote of the year here https://discord.com/channels/930051556043276338/1278977038430240813 🙂

henri-c · 4w ago

Similar Threads

Is it possible to use 'setValue' on all of a component in a component list?
AwexAAwex / help
12mo ago
How to control a Database studio component using an external button
NehsikNNehsik / help
2y ago
How can we use inline script to get source for a download button?
My_Name_Is_ShefMMy_Name_Is_Shef / help
2y ago
How to use wmill app push?
My_Name_Is_ShefMMy_Name_Is_Shef / help
3y ago