简体   繁体   English

在Turtle中使用Skulpt和Splinter for Python Web应用程序吗?

[英]Using Skulpt and Splinter for Python web application with Turtle?

I'm currently developing a web application where the primary function is Python's Turtle. 我目前正在开发一个Web应用程序,其主要功能是Python的Turtle。 When I started doing this I used Skulpt to be able to visualize and run my python code on the website, and it worked great. 当我开始这样做时,我使用Skulpt可以在网站上可视化并运行我的python代码,并且效果很好。 However, I need to give my python code an input from a form in the HTML-file. 但是,我需要给我的python代码一个HTML文件中表单的输入。 So I tried using Splinter for that problem, but it did not work, it seems as though the Python code stopped running when I wrote "from splinter import browser". 因此,我尝试使用Splinter来解决该问题,但没有成功,当我编写“从碎片导入浏览器”时,似乎Python代码停止运行。

Does anyone know if Splinter is not compatible with Skulpt or if there is another way I may go about to do this? 有谁知道Splinter是否与Skulpt不兼容,或者我是否还有其他方法可以做到这一点?

splinter is not implemented in skulpt. 碎片中未实现碎片。 You can write it yourself. 您可以自己编写。 Take a look at "Third Party Modules" on http://www.skulpt.org/ http://www.skulpt.org/上查看“第三方模块”

Another way is to change "input()": 另一种方法是更改​​“ input()”:

Sk.configure({
        inputfun: function (prompt) {
           return window.prompt(prompt);
        },
});

Here is an interesting post about change the input Wait for an event to occur within a function in Javascript for Skulpt 这是有关更改输入的有趣文章,它等待Skulpt的Javascript函数中发生事件

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM