[x3d-public] web based python/brython x3d scripts

John Carlson yottzumm at gmail.com
Mon Jan 23 18:45:25 PST 2023


Joe, here is github repo:

https://github.com/coderextreme/X3DJSONLD/tree/master/hello

Call me if you need any help setting it up (checkout README.txt).  The key
is to have python 3 on your system, so you can run a webserver (you can
CTRL-C to get out) in the project directory.

Also, it looks like brython.js needs an upgrade, so I'll be working on that.

John

On Fri, Jan 6, 2023 at 4:06 PM John Carlson <yottzumm at gmail.com> wrote:

> Here's what you put at the bottom of your python file, weblogo.py:
>
>
> # newModel is your main X3D top-level model object.
>
>
> ######################################################
>
> from browser import document
>
> def change(event):
>     src = newModel.Scene.HTML5()
>     document.getElementById("zone1").html = src
>     document.getElementById("zone2").text = "window.x3dom.reload();"
>
> document["button1"].bind("click", change)
>
>
> <-----------------Example HTML below---------------->
>
>
> <!doctype html><html>  <head>   <meta charset="utf-8"/>    <link rel="stylesheet" type="text/css" href="https://www.x3dom.org/download/1.8.2/x3dom.css"></link>    <script type="text/javascript" src="https://www.x3dom.org/download/1.8.2/x3dom-full.debug.js"></script>    <script src="https://code.jquery.com/jquery-3.6.0.min.js" integrity="sha256-/xUj+3OJU5yExlq6GSYGSHk7tPXikynS7ogEvDej/m4=" crossorigin="anonymous"></script>   <script type="text/javascript" src="brython.js"></script>   <script type="text/javascript" src="brython_stdlib.js"></script></head><body onload="brython(1)"><button id="button1">Press Button to Load Scene</button><x3d xmlns:xsd="http://www.w3.org/2001/XMLSchema-instance" profile="Immersive" version="3.3" xsd:noNamespaceSchemaLocation="http://www.web3d.org/specifications/x3d-3.3.xsd" width="300px" height="300px" backend="webgl"><scene id="zone1" class="zone"></scene></x3d><script type="text/python" src="weblogo.py"></script><script type="text/javascript" id="zone2"></script></body></html>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20230123/32bd1009/attachment.html>


More information about the x3d-public mailing list