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

Using Brython in QML

I try to use Python in QML and I think Brython is a convenient javascript library to enable Python on-the-fly. But as far as I know Brython uses web browser tools only. Is it possible to embed Brython in QML in order to use it like…
ercishli
  • 25
  • 1
  • 7
0
votes
1 answer

How to set value input() function in Brython, not confirm dialog?

My code: a = input() print(a) I want set value from input not confirm dialog. What should I do?
0
votes
1 answer

Using Brython code with more than one calculation

I'm trying to start using Brython in an on-line course. In order to test it I created a simple unit-conversion exercise where a student fills in a speed in mph and gets back the speed in ft/s. Works fine. But I find that any second calculation I add…
0
votes
2 answers

Brython-3.4.0: Using etree.ElementTree triggers pyexpat import and tracebacks

I have a small test page for Brython related tests and recently added xml.etree.Elementree module there, but it doesn't work for some reason. I've following code (actually there is more stuff but I removed the irrelevant parts):
Juha Tuomala
  • 111
  • 11
0
votes
2 answers

Brython bind a click event to an id that is not yet in the page

So I have the following dilemma: I am using Brython and everything is working ok. I have a small piece of code that executes ajax requests for me and I added that in the header to bind everything on the current elements in the page. from browser…
Nick
  • 545
  • 12
  • 31
0
votes
2 answers

JS function in Brython

I wrote some simple js functions in objects.js file, but I can't reach them in python script When i paste all code from file to index.html, everything works fine How to execute functions from file objects.js ? index.html:
1pietras
  • 23
  • 6
0
votes
1 answer

Uncaught ReferenceError: rotateAnimation is not defined(anonymous function)

please have patience for me, I am new at programming :) I am testing Brython in browsers. I have this code for simple rotate image, in this case it's a cog. I wan to use python and DOM to animate this image of cog. This is the code:
Monica
  • 111
  • 11
0
votes
1 answer

How to draw to a canvas in brython?

I was recently trying out Brython and I'm having trouble figuring out how to draw a simple rectangle to a canvas.I can only find very complex examples of drawing to a canvas that don't work for me and I was unable to find a clear answer in the…
0
votes
1 answer

Space-efficient (de)serialise array of MyClass instances

My object looks like this: class Note(object): def __init__(self, note, vel, t, tOff=0): self.note = note # ubyte self.vel = vel # ubyte self.t = t # float self.tOff = tOff # float (The type…
P i
  • 29,020
  • 36
  • 159
  • 267
0
votes
1 answer

Unable to import os in Brython - TypeError

I am trying to import the os module in Brython, but no matter what I do, no matter what I try, I am unable to. I get the following error (in the Firefox console): "TypeError: obj is undefined for module os" brython.js:6329:21 "message: undefined"…
Ardjan
  • 21
  • 6
0
votes
1 answer

python markdown which version has a mark method

When experimenting with the brython project, running "scripts/make_dist" always gets an error: File "../scripts/make_dist.py", line 14, in import make_doc # lint:ok File "/home/.../brython-3.1.1/scripts/make_doc.py", line 42, in…
minghua
  • 5,981
  • 6
  • 45
  • 71
0
votes
2 answers

Brython with sqlite3

I am trying to make simple webpage that will read data from SQLite file and show it in webpage, it is very simple I want to do 3 SQL query and show result. I have idea to use Brython for it, because it look easier that to make Django/Flask app, This…
WebOrCode
  • 6,852
  • 9
  • 43
  • 70
-1
votes
1 answer

How to create a form in Brython where entering a name hides the form and displays a welcome message in a div?

I want to implement a functionality using Brython where I have a form that allows me to enter my name. Once I enter my name and submit the form, I want the form to disappear and a div to appear with a welcome message displaying "Welcome, [name]"…
One Piece
  • 1
  • 1
-1
votes
1 answer

How can I pass JSON data through serialization and then parse them using external Brython script?

The attached Flask+Brython source code was supposed to print 20 random numbers (between -100 and 100) on the browser screen. However, it doesn't. The Brython script is failing to parse JSON data. How can I fix this? app.py from flask import Flask,…
user366312
  • 16,949
  • 65
  • 235
  • 452
-1
votes
1 answer

How to use Vuetify from brython

Here is a small sample of using Vuetify. How can I correctly translate it into brython ?
Osh
  • 1
  • 1