Pages not dynamic enough (?) #1258
-
Beta Was this translation helpful? Give feedback.
Answered by
FlorianJacta
May 6, 2024
Replies: 1 comment 1 reply
-
Would partials help you? It is a way to change a part of your page in real-time. Here is an unrelated code to explain how partials can be used: from taipy.gui import Gui
import taipy.gui.builder as tgb
value = 15
min_slider = 10
max_slider = 200
def create_slider_partial(min_slider=10, max_slider=200):
with tgb.Page() as new_slider:
tgb.slider("{value}", min=min_slider, max=max_slider)
return new_slider
def change_partial(state):
state.slider_partial.update_content(state, create_slider_partial(state.min_slider, state.max_slider))
with tgb.Page() as main_page:
tgb.text("Change the minimum:")
tgb.number("{min_slider}", on_change=change_partial)
tgb.text("Change the maximum:")
tgb.number("{max_slider}", on_change=change_partial)
tgb.text("Value of slider: {value}, minimum of slider: {min_slider}, maximum of slider: {max_slider}")
tgb.part(partial="{slider_partial}")
gui = Gui(main_page)
slider_partial = gui.add_partial(create_slider_partial())
gui.run(port=2552) |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
s4n-cz
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Would partials help you? It is a way to change a part of your page in real-time.
Here is an unrelated code to explain how partials can be used: