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

Brython for Firefox OS

Cookbook

 

To install Brython :

  • if your PC has CPython and pip, install the package brython by

    pip install brython

then in an empty directory run

    python -m brython --install

  • if you can't use this method, go to the releases page on Github, select the latest version, download and unzip Brython-x.y.z.zip.

In both cases the directory has the following files :

  • brython.js : the Brython engine, to include in the HTML page
  • brython_stdlib.js : groups all the modules and packages of the part of the Python standard library supported by Brython
  • demo.html : a page with a few examples of how to use Brython for client-side development

brython.js includes very often used modules : browser, browser.html, javascript.

If your application uses modules of the standard distribution, you need to include brython_stdlib.js besides brython.js:

<script type="text/javascript" src="brython.js"></script>
<script type="text/javascript" src="brython_stdlib.js"></script>