Partials in multi-page apps #1527
-
Hi there, I am new to Taipy, and doing my first steps building a multi-page app, which should show some data which are getting updated every once in a while. my basic code:
in Page1.py:
I would like to be able to initiate/add the partial in the Page1 class. But as far as I understand I have to do it on Gui level, like:
But If I have to place the code in main.py, I would need to change main.py whenever I want to add a partial in a sub-page. Any hint would be appreciated |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
I don't know where you got this syntax (which is a great syntax), however, there has yet to be any documentation on it. You can follow this article to understand how partials work. Here is basically how you would use this partial on page 1. Partials are global variables, but they can be put on a subpage. class Page1(Page):
def __init__(self):
super().__init__()
def page1(self):
with tgb.part("container"):
tgb.text(f"# Hello World {self.username}", mode='md')
def create_page(self):
with tgb.Page() as page:
self.page1()
tgb.part(partial="{prompt_user}")
return page |
Beta Was this translation helpful? Give feedback.
Yes, it is ok. I am just unsure if I will be able to answer you as it has not been thoroughly tested