Can anyone help me anything related to --- how to draw 3D objects like sphere, cone, arrow, ring etc. I am new to python but know the basic language.

Thanx,
Anjali

Recommended Answers

All 4 Replies

Check the "Open Graphics Library" (OpenGL), there is a Python wrapper for it called PyOpenGL.

VPython (VisualPython) might be easier to deal with:
http://vpython.org/

Here is a VPython example ...

# a simple red cylinder in space
# experiments with visual Python (VPython)
# download from: [url]http://vpython.org/[/url]
 
import visual as vs
 
# (x, y, z) coordinates
cyl = vs.cylinder(pos=(-3, 2, 1), axis=(5, 0, 3), radius=3)
 
# (r, g, b) color values (0.0 to 1.0)
cyl.color = (1.0, 0, 0)

Just play with the coordinates to get a feel! You can also press the right mouse button and rotate the object!

Color me 'impressed'...

Color me 'impressed'...

Nice science module, isn't it?

If you are interested, I just left an example of a bouncing ball between walls (modified from the PDF demo) in the "Starting Python" thread at:
http://www.daniweb.com/forums/post438244-109.html

This one would be a nice code to modify to a bouncing ball of the floor, gradually reaching less and less height. Something for your students to accomplish.

Thanks for the information:-)
I have found one 8 page pdf tutorial on vpython, which is self sufficient.
Thanks a lot
Anjali.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.