skulpt / skulpt

Skulpt is a Javascript implementation of the Python programming language

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How To Stop Any Previously Running Code Before Running New Code

chrisjd20 opened this issue · comments

How do you stop any previously running python code before re-running new code.

For example, if im running my code like this:

Sk.misceval.asyncToPromise(function() {
    return Sk.importMainWithBody("<stdin>",false,editor.getValue(),true);
});

In my python editor i have:

import elf
while True:
    elf.moveLeft(5)
    elf.moveUp(4)
    elf.moveRight(4)
    elf.moveDown(4)

Problem is that when I run this, and then click run again, I have two sepparate instances of python code animating my character which causes it to be moving based on the instructions of both running instances of the python code.

How do I stop all previous executions anytime I run my python code?

commented

Here's a jsfiddle that should help

https://jsfiddle.net/sc549/bjLuq5s7/

Ok thanks. I'll try it out and let you know how that works out.

That works, thanks!