Closed failable closed 2 months ago
Hi, your selector is not bound to any variable. This behavior is normal.
I have bound your selector to a variable called selected_collection. Try this code and tell me if this works:
import taipy.gui.builder as tgb
from taipy.gui import Gui
def on_change(state, var, val):
print(var)
print(val)
if __name__ == "__main__":
collection_names = ["collection1", "collection2", "collection"]
selected_collection = None
with tgb.Page() as page:
tgb.selector(
value="{selected_collection}",
label="Collection",
lov=collection_names,
dropdown=True,
on_change=on_change,
)
Gui(page=page).run(
dark_mode=False,
debug=True,
use_reloader=True,
port=5001,
)
@FlorianJacta Thanks, that works!
Great to hear! You can now access your real-time variable selected_collection in any callback.
What went wrong? 🤔
The
on_change
function of selector is not working.Expected Behavior
The
on_change
function of selector should work.Steps to Reproduce Issue
Test code:
Solution Proposed
No response
Screenshots
No response
Runtime Environment
macOS 14.5 (23F79), Chrome Version 125.0.6422.142 (Official Build) (x86_64)
Browsers
Chrome
OS
Mac
Version of Taipy
taipy==3.1.1 taipy-config==3.1.1 taipy-core==3.1.1 taipy-gui==3.1.2 taipy-rest==3.1.1 taipy-templates==3.1.1
Additional Context
No response
Acceptance Criteria
Code of Conduct