Introduction

Installation

Limitations of the "file" protocol

Frequently asked questions

Syntax, keywords and built-in functions

Standard distribution

import implementation

Brython packages

Browser 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 Brython

Options of function brython()
Testing and debugging
Deploying an application

Cookbook

Hello world !
Insert content in an element
HTML markup (bold,italic...)
HTML table
Bind and unbind events
Handle options in a SELECT
Drag and drop
Get the content of an element
Read the content of a file
Store objects locally
Example of onmouseover
 

Deploying a Brython application

The application can be deployed by uploading the whole directory content on the server.

Since version 3.4.0 it is also possible to deploy a Brython application using the same tool as for CPython packages, ie pip.

For that, install the CPython Brython package (pip install brython), open a console window and in the application directory run:

brython-cli --make_dist

On first execution, the user is asked to enter required information for a package : its name, version number, etc. This information is stored in a file brython_setup.json that can be edited later.

The command creates a subdirectory __dist__ ; it includes the script setup.py that is used to create a package for the application, and to deploy it on the Python Package Index.

Users can then install the CPython package by the usual command:

pip install <application_name>

and install the Brython application in a directory by:

python -m <application_name> --install