Trusted answers to developer questions
Trusted Answers to Developer Questions

Related Tags

python

How to do dynamic construction in Flask

Hassan Azhar

Dynamic Construction

Dynamic Construction refers to the rendering of certain objects upon the occurrence of an event.

This may be useful to show a search bar when the search button has been pressed or to show a resource-intensive object when required.

Code

The following example shows how Dynamic Construction can be carried out.

def navigation_bar():
    return Navbar(...)

nav.register_element('navigation_bar', navigation_bar)

This example shows the use of register_element, a function that registers the element to be shown. The parameters are the element ID and the function to be called. Whenever the element needs to be shown, the navigation_bar() function will be called.

RELATED TAGS

python

CONTRIBUTOR

Hassan Azhar
Copyright ©2022 Educative, Inc. All rights reserved
RELATED COURSES

View all Courses

Keep Exploring