赞
踩
function outf(text) {
var mypre = document.getelementbyid("output");
mypre.innerhtml = mypre.innerhtml + text;
}
function builtinread(x) {
if (sk.builtinfiles === undefined || sk.builtinfiles["files"][x] === undefined)
throw "file not found: '" + x + "'";
return sk.builtinfiles["files"][x];
}
function runit() {
var prog = document.getelementbyid("yourcode").value;
var mypre = document.getelementbyid("output");
mypre.innerhtml = '';
sk.pre = "output";
sk.configure({ output: outf, read: builtinread, __future__: sk.python3});
(sk.turtlegraphics || (sk.turtlegraphics = {})).target = 'mycanvas';
var mypromise = sk.misceval.asynctopromise(function() {
return sk.importmainwithbody("", false, prog, true);
});
mypromise.then(function(mod) {
console.log('success');
},
function(err) {
console.log(err.tostring());
});
}
import turtle
print('hello')
t = turtle.turtle()
t.color('red')
t.forward(75)
run
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。