-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Thank you for working on this project! I am interested in using it in an educational setting. After some experimentation, I believe there is at least one architectural issue that would block us from using it in a production environment. Primarily, a typical "lesson" web page will need to display multiple, independent examples on the same page.
If I understand the current setup correctly, turtle-pyscript is hard-coded to display output in a
<div id="tps-game-area">
<div id="tps-game-box"> </div>
</div>
A <script> element containing code will then automatically interact with those well-known divs.
What we'd need is the ability to add multiple <script> elements and output
<div id="tps-game-area1">
<div id="tps-game-box1"> </div>
</div>
<script type="py" something="... some way to target this script to tps-game-area1 for I/O...">
code for instance 1...
</script>
<div id="tps-game-area2">
<div id="tps-game-box2"> </div>
</div>
<script type="py" something="... some way to target this script to tps-game-area2 for I/O...">
code for instance 2...
</script>
...or even better, perhaps convert from id to class, then have each script placed within a parent
<div class="tps-game-area">
<div class="tps-game-box"> </div>
<script type="py">
code for instance 1...automatically interacts with the parent tps-game-area
</script>
</div>
<div class="tps-game-area">
<div class="tps-game-box"> </div>
<script type="py">
code for instance 2...automatically interacts with the parent tps-game-area
</script>
</div>
In our experimentation, copying multiple <script> elements within the same page meant that each script element tried to use the same
Possibly, there are already workarounds we didn't catch for these issues - would love to see a sample HTML page demonstrating multiple instances if available :)