Questions tagged [brython]

Brython is a browser-integrated Python engine.

Brython stands for Browser's Python. It's goal is to replace JavaScript with Python as the scripting language for web browsers. It is composed of a lightweight run-time translation layer that brings many of Python's syntax niceties directly to the browser, as simple as using a <script type="text/python"> tag.

Some possible uses are

  • Creating simple document elements,
  • Drag and drop elements
  • 3D navigation
  • Geolocation
  • Charts and graphs

For more examples visit the home page and refer to the gallery.

Brython is open source and the source code is available here. Documentation can be found at http://www.brython.info/doc/en/index.html.

108 questions
0
votes
0 answers

After calling 'add_key_down_handler(argmt)' how could I set it up so that when one of the keys is pressed the handler stops running? (Python)

For instance in this code: def check(event): if event.key == "a": function() add_key_down_handler(check) If the key "a" is clicked again after this, function() should not run. The way I tried to solve this was to do the…
0
votes
1 answer

In Python, using Brython, I'm getting an unwanted rectangle in my output

When executing a python script (using Brython in a sandbox on codehs.com), I'm getting an extra white rectangle, left of the grid I'm outputting to the screen: When inspecting the html, I can see where it is coming from: Is there any way I can get…
0
votes
1 answer

Brython python to javascript converter

I want to create a tool using brython that translates python to js without running it. I know that there is a way to do it (i was doing some research: http://www.brython.info/tests/precompile.html or Python to JavaScript converter) but still i…
0
votes
0 answers

Uncaught ReferenceError: _test() is not defined

Why am I getting the error Uncaught ReferenceError: _test() is not defined in the following source code
0
votes
1 answer

Is it possible to run PyTorch in brython script?

I'd like to embed a simple PyTorch model in a webpage. Is this something accomplishable with brython? If not, is there another tool available that would allow for PyTorch scripts to be executed without a separate server hosting the code?
DerekG
  • 3,555
  • 1
  • 11
  • 21