My system has Python 3.7.4 installed under Windows 10. I followed the directions for Installing Jupyter Notebook via command line:
Then running via command line:
Jupyter Notebook then lauched successfully. Next: Running the Notebook.
I created this HelloJupyterNotebook page and then loaded the x3d package into Pythonas follows.
import x3d
x3d package loaded, have fun with X3D Graphics!
Since the x3d.py package is experimental, successful loading is confirmed by the message above.
The following model fragment demonstrates an X3D model running in jupyter notebook. Note that each of the X3D nodes and statements are namespaced with the prefix x3d. Also note that field names are not prefixed.
import x3d
newModel = x3d.X3D(
head=x3d.head(children=[
x3d.component(name='Core',level=2),
x3d.unit(),
x3d.meta(name='title',content='HelloJupyterNotebook.py')]),
Scene=x3d.Scene(children=[
x3d.WorldInfo(),
x3d.Group()]))
Here is an intentional error forcing a Python TypeError, thus showing that the notebook is active.
newModel + 2;
--------------------------------------------------------------------------- TypeError Traceback (most recent call last) <ipython-input-13-eaf770075e07> in <module> ----> 1 newModel + 2; TypeError: unsupported operand type(s) for +: 'X3D' and 'int'