[x3d-public] Working on a X3DOM brython app (canvas/log initially shows, but innerHTML may wipe it out.?)

John Carlson yottzumm at gmail.com
Thu Dec 22 00:18:10 PST 2022


# Main x3d.py app goes here.

# Call this file HelloWorld.py

# I can't set up a web host for this yet.  I use localhost/firefox

# Set a time for a zoom meeting!

# I did get the demo.html file working in brython. That's good news.

# it's been a long time since I used x3dom, forgot all about showLog!




######################
# Main display code. Should display earth, but wipes out canvas, I think.
# Goes in HelloWorld.py too
######################

from browser import document

def change(event):
    src =  newModel.Scene.HTML5()
    print(src)
    document.getElementById("zone1").innerHTML = src
    document.getElementById("zone2").text = "window.x3dom.reload();"

document["button1"].bind("click", change)

<!--###################################
# Web page. Save to index.html
###################################-->

<!doctype html>
<html>
  <head>
   <meta charset="utf-8"/>
    <link rel="stylesheet" type="text/css" href="
https://www.x3dom.org/download/dev/x3dom.css"></link>
    <script type="text/javascript" src="
https://www.x3dom.org/download/dev/x3dom-full.debug.js"></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 id="zone1" class="zone" 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" showStat="false"
showLog="true" width="300px" height="300px" backend="webgl">
</x3d>
<script type="text/python" src="HelloWorld.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/20221222/6ace3728/attachment-0001.html>


More information about the x3d-public mailing list