Frequently asked questions

Syntax, keywords and built-in functions

Standard distribution

import implementation

Browser interface

Brython-specific built-in modules

Working with Brython

Brython for Firefox OS



The package browser groups the built-in Brython-specific names and modules

a function that prints the message in a pop-up window. Returns None

a function that print the message in a window, and two buttons (ok/cancel). Returns True if ok, False if cancel

an object with methods to interact with the browser console. Its interface is browser-specific. It exposes at least the method log(msg), which prints the message msg in the console

an object that represents the HTML document currently displayed in the browser window. The interface of this object is described in section "Browser interface"

the class of DOM events

the class of DOM nodes

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 <script src="prog.js"></script>.

The names inserted by the library inside the global Javascript namespace are available in the Brython script as attributes of the window object.

For instance, the module jqueryui in Brython standard library provides an interface with the Javascript library jQueryUI. To use it in a Brython script, you simply write import jqueryui without inserting the Javascript libraries in the page. It's the module jqueryui that loads them, using this function load()

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 string

an object that represents the browser window