IntroductionInstallationLimitations of the "file" protocolFrequently asked questionsSyntax, keywords and built-in functionsStandard distributionimport implementationBrython packagesBrowser interface
Introduction - DOM API
Creating a document Accessing elements Attributes, properties and methods Events Mouse events Keyboard events Focus events Drag events Query string Interactions with Javascript Brython-specific built-in modules
browser
browser.aio browser.ajax browser.html browser.local_storage browser.markdown browser.object_storage browser.session_storage browser.svg browser.template browser.timer browser.webcomponent browser.websocket browser.worker Widgets browser.widgets.dialog browser.widgets.menu interpreter javascript Working with BrythonCookbook |
Testing and debuggingInteractive testThe Brythons site, or its mirror available for download, include a console where you can test Python code. Please note that the namespace is not refreshed when you click on "run", you must reload the page for that. For debugging and testing Brython, a number of test scripts are grouped in the directorytests ; you can access them by clicking the link "Test pages" in
the console, then select the different tests and run them.
Debugging scriptsWhatever the debugging level, syntax errors are reported in the browser console (or at the place defined bysys.stderr )
For instance, the code
x = $a generates the message By setting the debugging level to 1 in the call to functionSyntaxError: unknown token [$] module '__main__' line 1 x = $a ^ brython(debug_mode) , the exceptions raised at runtime and not
caught by an except also produce an error message, as close as possible to
the one generated by Python3.
This code :x = [1, 2] x[3]generates : IndexError: list index out of range module '__main__' line 2 x[3] |