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 |
The package browser groups the built-in Brython-specific names and modules browser.alert( message)
a function that prints the message in a pop-up window. Returns
browser.bind( target, event)
a function used as a decorator for event binding. Cf. section events.browser. confirm( message)
a function that prints the message in a window, and two buttons (ok/cancel). Returnsbrowser. console
an object with methods to interact with the browser console. Its interface
is browser-specific. It exposes at least the method
browser.document
an object that represents the HTML document currently displayed in the browser window. The interface of this object is described in section "Browser interface"browser. DOMEvent
the class of DOM eventsbrowser. DOMNode
the class of DOM nodesbrowser. is_webworker
boolean indicating if the current script is executed in a Web Workerbrowser. load( script_url)
Load the Javascript library at address script_url.
This function uses a blocking Ajax call. It must be used when one can't
load the Javascript library in the html page by
The names inserted by the library inside the global Javascript namespace
are available in the Brython script as attributes of the
browser.prompt( message[,default])
a function that prints the message in a window, and an entry field. Returns the entered value ; if no value was entered, return default if defined, else the empty stringbrowser. run_script( src[, name])
this function executes the Python source code in src with an optional
name. It can be used as an alternative to
browser.window
an object that represents the browser window (see the MDN documentation) |