EzDevInfo.com

skulpt

Skulpt is a Javascript implementation of the Python programming language

Using Matplotlib Output Client-Side in Browser With Skulpt

I am writing a Python application to be run client-side within the browser. The Skulpt project looks great for this, and I am pretty excited to begin working with it.

The one issue I can foresee, however, is that I will need graphical output using Matplotlib. Does Skulpt support Matplotlib? If not, what other options do I have?


Source: (StackOverflow)

Python in Browser: How to choose between brython, pypy.js and skulpt?

EDIT: Please note I'm NOT asking for a (subjective) product recommendation. I am asking for objective information -- that I can then use to make my own decision.

I'm very excited to see that it is now possible to code Python inside a browser page. The main candidates appear to be:

http://www.brython.info/
http://www.skulpt.org/
http://pypyjs.org/

(If there is another viable candidate I'm missing, please put me right!)

But how to choose between them?

(EDIT: Please note, I'm not asking for a candidate nomination. I'm seeking information that will allow me to make an educated choice.)

The only obvious difference I can see is that Skulpt emulates Python 2.x whereas Brython emulates Python 3.x.


Source: (StackOverflow)

Advertisements

How to use Skulpt to eval Python line by line

The example given by Skulpt runs the interpreter on the whole string containing the python program:

https://github.com/skulpt/skulpt/blob/master/example/calling_from_js.html

Is there a possibility to run the interpreter line by line, for example in order to highlight the Python line which is currently executed?

Thank you in advance.


Source: (StackOverflow)

Embedding Python Game Into HTML Using Skulpt

I have written a game in Python using the PyGame library that I am trying to embed into an HTML page to allow me to play in a web browser.

I am attempting to do this using the JavaScript library Skulpt. I have attached a test script below that successfully outputs the print statement below.

skulpt.html

<html>
<head>
    <script src="assets/skulpt/skulpt.js" type="text/javascript"></script> 
</head>
<body> 
    <textarea id="pythonCode">
        print "I am python."
    </textarea><br /> 
    <pre id="output"></pre> 

    <script type="text/javascript">
        function outf(text) { 
            var mypre = document.getElementById("output"); 
            mypre.innerHTML = mypre.innerHTML + text; 
        } 

        var code = document.getElementById("pythonCode").value; 
        Sk.configure({output:outf}); 
        eval(Sk.importMainWithBody("<stdin>",false,code)); 
    </script>
</body>
</html>

Output of skulpt.html:

enter image description here

The issue that I am having is that when I use my game code instead of the simple print statement shown above it produces the error seen below;

enter image description here

I have included all relevant images to my web servers' directory at the correct path. I am unsure of why this error is being produced. Any help would be much appreciated, thanks!

Also, here is the attached Python game code (and a live demo of the error):

http://nicolasward.com/portfolio/skulpt.html


Source: (StackOverflow)