Jupyter VPython Notebook

229 views
Skip to first unread message

katie

unread,
Jan 25, 2017, 8:12:39 AM1/25/17
to VPython-users
Hi

I am trying to do the following commands to import materials in a Python Jupyter notebook.

Vpython works, but I am trying to add a material from an image.

As follows.
from visual import *
imprort vpython
****** Visual package is not recognized*

How do I get visual to be imported? I tried pip install visual, but it was not recognized.


name = "Pic"
width = 128 # must be power of 2
height = 128 # must be power of 2
im = Image.open(name+".png")
im = im.resize((width,height), Image.ANTIALIAS)
tex = material.texture(data=im, mapping='rectangular')

But, material is not known to vpython.

Do you have any suggestions?

Thank you
Katie

Bruce Sherwood

unread,
Jan 25, 2017, 9:04:37 AM1/25/17
to VPython-users
See instructions on the first page of vpython.org. What you need is "pip install vpython" and "from vpython import *". In Classic VPython the name of the module was visual.

As for material, the attribute in Jupyter VPython is texture, not material. At glowscript.org, click Help for the documentation on Jupyter VPython.

A more general statement is that Classic VPython is still available on the download pages at vpython.org but is no longer supported, nor can Classic VPython display in a Jupyter notebook, so I'm puzzled by your statement that "VPython works".
Reply all
Reply to author
Forward
0 new messages