python3dgraphic

python 3D visualization and graphics


I am looking for Python compatible 3D graphics. Mostly I would like to be able to draw lines and view them in 3D. I literally have no experience in this area and am looking for knowledge and tutorials.

I learn programming best by experimentation. So which packages do I need to do 3-D graphics? I really enjoy using emacs, so if you have those suggestions as well that would be awesome!

In summary:

  1. Which packages do I need for 3D graphics in python.
  2. Note that I use Ubuntu 12.04 LTS and emacs 24.3

Solution

  • For 3D charts and graphs (Edit)

    If you just need to draw a 3D graph and periodically update it, gnuplot may be appropriate. Using Python's subprocess library you can spawn it in a process to produce graphs, with a variety of output formats, such as SVG or PNG.

    Also see Tom's answer below for an alternative library recommendation.

    For Realtime 3D (Original)

    This answer is for those who are interested in realtime graphics.

    The standard way to render 3D graphics is with the OpenGL library which interfaces with the GPU. OpenGL is a big topic, but focusing on a specific application, like drawing 3D lines should not be too difficult.

    Bindings exist for python http://pyopengl.sourceforge.net/

    GLUT - is probably the best for providing X platform windowing and context setup, and is included in the mentioned bindings.

    OpenGL - there are two main ways to use Opengl, a "legacy" style, and a "modern" one. For simple applications legacy is often easier to get started, although learning modern is a better long-term investment.

    Here are some links for learning - Don't feel obligated to read them all - pick the topics that are relevant to you.