Part 3 — APP Handlers [Handle Events and Errors]
In this part, we will introduce you to app handlers and tell you what they are for.
Table of contents
Step 1 — Handle HTML events
How do I make the IU buttons work? It's very simple. In the HTML file, I will create a button that invokes the command on click:
src/gui.html (partially)
In Python code I will handle this command using callback handler
src/main.py (partially)
This callback is triggered if the command name matches the name of the callback parameter. Arguments that come to the input:
api — api the object of the user who called the callback
task_id — app task_id
context — information about the environment in which the application is running
state — state of all widgets in Python dict format
app_logger — sly_logger with task_id
Step 2 — Dialog window instead of an error
Sometimes we want the application not to crash after an error occurs.
Therefore, we can use app.ignore_errors_and_show_dialog_window()
handler:
src/main.py (partially)
Step 3 — Results
Last updated