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 Using Javascript objects and libraries 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 |
module javascriptThe module javascript allows interaction with the objects defined in Javascript programs and libraries present in the same page as the Brython program. javascript.py2js( src)
Returns the Javascript code generated by Brython from the Python source code src.javascript. this()
Returns the Brython object matching the value of the Javascript objectThe module also allows using objects defined by the Javascript language. Please refer to the documentation of these objects. javascript. Date doc
Constructor of date / time objects. javascript.from javascript import Date date = Date.new(2012, 6, 10) print(date.toDateString()) JSON doc
Object to convert to and from JSON objects. It exposes two functions:
javascript. Math doc
Object for mathematical functions and constants.javascript. NULL
the Javascript objectjavascript. Number doc
Constructor for objects of type "number".javascript. RegExp doc
Constructor of "regular expression" objects, using the Javascript-specific
syntax, which doesn't fully match that of Python.
The method
javascript.from javascript import RegExp re = RegExp.new(r"^test(\d+)$") print(re.exec("test44")) String doc
Constructor of Javascript objects of type "string". Must be used to call methods that accept Javascript regular expressions as parameters: javascript.from javascript import RegExp, String re = RegExp.new(r"^test(\d+)$") print(String.new("test33").search(re)) UNDEFINED
the Javascript object |