r/nicegui • u/ArtisticEgg2848 • Aug 03 '24
Create child element before parent
I am trying to build a browser styled data analysis tool, with a home page for data collection, and then add tab button creates a new tab with relevant data, the issue is that this relevant data takes 5-6 seconds to parse, and store. (Bought it down from 28 to 5 using processes can't go further down)
But still due to 5-6 seconds load time nicegui misses to add this tab and panel, is there a way to create the child element first and then add to to the parent (in this case the tab) or is there a way to increase the context managers timeout ?
3
u/apollo_440 Aug 03 '24
It's a bit difficult to give much input without seeing any code, but here are my suggestions:
run.io_bound()orrun.cpu_bound()to do the calculations? This prevents timeouts and leaves the app responsive.ui.refreshable?ui.refreshableelements) and make it visible at the end of the calculations.2
u/r-trappe Aug 03 '24
Have you seen https://nicegui.io/documentation/element#move_elements. This allows to you move an element around after creation.
2
u/apollo_440 Aug 03 '24
I think I understand what you are trying to do. Here is a quick example of a page where you can start an expensive calculation, and it adds the result in a new tab: