It may be a stupid question, but is there already some DOM access or a dedicated package that allows writing web applications in this compiled python?
https://blog.pyodide.org/posts/react-in-python-with-pyodide/
Similar examples for raw DOM manipulation should be available for Pyodide as well. It has bindings to all JS code, so it can do everything that JS can do.