ToUI with JavaScript
====================
ToUI does not restrict you from using JavaScript code. It can also allow you to call Python functions
from JavaScript. However, note that ToUI creates some JavaScript functions that should not be overwritten.
These functions start with an underscore.
This example uses the HTML file "test5.html":
.. code-block:: html
Document
Python code:
.. code-block:: python
from toui import Website, Page
# create website
app = Website(__name__, assets_folder="assets", secret_key="some text")
# create page
main_pg = Page(html_file="assets/test5.html", url="/")
# create a function and add it to the page
def pythonFunction():
print("A Python function was called from JavaScript.")
main_pg.add_function(pythonFunction)
# add the page to the website
app.add_pages(main_pg)
# run
if __name__ == "__main__":
app.run(debug=True)