Joldz 🔮
Joldz 🔮
Created by Joldz 🔮 on 6/3/2024 in #help
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) 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) bc when I do I get the following error 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.
5 replies