I want to make a Rubik's cube with VPython and I've faced a problem in the first stage! I want to color every face of a box with a different color but I can't find that! In the tutorial you only can color all of the faces of the box with one certain color!
What should I do?
Note: I'm using VPython 7 and Python 3.6
You can also make a box with different colored faces using a compound object made up of 6 pyramid objects each of a different color.
def cubelet(....): # a "factory function"
#create a list of the 6 pyramids with different colors; suppose its name is L
L = [pyramid(color=color.red,pos=vec(),axis=vec()), ... ]
return compound(L)
c = cubelet(....)
This "factory function" (a function that returns an object) returns an object that has the usual properties of primitive objects such as box. You can manipulate this compound object by changing c.pos or c.axis, etc. You can create copies of this cubelet:
c2 = c.clone(pos=vec(10,5,0), size=vec(2,1,0.2))
For pyramid see documentation
http://www.glowscript.org/docs/VPythonDocs/pyramid.html
Just arrange 6 of these in the shape of a box. For compound object see
http://www.glowscript.org/docs/VPythonDocs/compound.html
to make a compound object out of 6 pyramids.