Introduction

Installation

Frequently asked questions

Syntax, keywords and built-in functions

Standard distribution

import implementation

Browser interface

Brython-specific built-in modules

Working with Brython

Cookbook

 

Introduction

For the interface with the browser, Brython is compliant with the Document Object Model interface, which is widely documented on the web :

This interface is language-independent. With Brython, all the operations described in the DOM API rely on two objects defined in the module browser : document and window

document implements the interface Document defined in the DOM API. For instance, it supports the following methods :

document.getElementById(elt_id)

returns a reference to the DOM element whose id is elt_id

document.createElement(tagName)

returns a new element of type tagName ; for instance, to create an hypertext link :

link = document.createElement('A')

document.appendChild(elt)

add the element elt to the document

Besides this standard interface, Brython propose an alternative interface, more familiar for Brython developers. It is described in the following pages