Closed Forchapeatl closed 11 months ago
The correct syntax for the page builder is this one:
import taipy as tp
import taipy.gui.builder as tgb
from taipy import Gui, Config, Core
input_name = "Taipy"
message = None
with tgb.Page() as page:
tgb.input("{input_name}")
tgb.text("{message}")
tgb.button("submit" , on_action='submit_scenario')
def submit_scenario(state):
state.scenario.input_name.write(state.input_name)
state.scenario.submit(wait=True)
state.message = scenario.message.read()
def build_message(name: str):
print(name)
return f"Hello {name}!"
input_name_data_node_cfg = Config.configure_data_node(id="input_name")
message_data_node_cfg = Config.configure_data_node(id="message")
build_msg_task_cfg = Config.configure_task("build_msg", build_message, input_name_data_node_cfg, message_data_node_cfg)
scenario_cfg = Config.configure_scenario("scenario", task_configs=[build_msg_task_cfg])
if __name__ == "__main__":
Core().run()
scenario = tp.create_scenario(scenario_cfg)
Gui(page).run()
This should work properly. You still need the "
and the {
for the binding of Taipy variables.
Than you. It worked
Description of the problem
Hello every one , Gui with page builder is unable to read changes on the input data node, hence passes stactic values to the build_message() function, and writes no result to the output data node
https://github.com/Avaiga/taipy/assets/24577149/21b1043c-c1a8-4da5-9984-24ded7d26a3a
Expected behaviour
This code generates page with markup
https://github.com/Avaiga/taipy/assets/24577149/ef734457-6c2f-4b05-86ed-4fcc0a5e42cf