FAQ

How to make the input form not disappear after submission, and can continue to receive input?

The design of PyWebIO is that the input form is destroyed after successful submission. The input function of PyWebIO is blocking. Once the form is submitted, the input function returns. So it is meaningless to leave the form on the page after submission of form. If you want to make continuous input, you can put input and subsequent operations into a while loop.

Why the callback of put_buttons() does not work?

In general, in Server mode, once the task function returns (or in Script mode, the script exits), the session closes. After this, the event callback will not work. You can call the pywebio.session.hold() function at the end of the task function (or script) to hold the session, so that the event callback will always be available before the browser page is closed by user.

Why I cannot download the file using put_file()?

The reason is the same as above. The page needs to request server for data when the download button is clicked, so the download link will be unavailable after the session is closed. You can use the pywebio.session.hold() function at the end of the task function to hold the session.