Monday, August 24, 2009

Drag Drop Module Up and Running

Start with a liitle experimentation with the Chessboard tutorial for Panda. Add to that substantial help from the Panda community. And voila! You get a working Drag Drop Module.

Here's a few screenshots:

This is the initial screen. The script provides the user with the capability to select and move the squares across the screen.

The screenshot has somehow not captured the mouse position. The light purple square being dragged. The next image displays the subsequent selection and dragging of the green square.

The code is available at my uhuroo site. Running the code in the Python shell returns the following error:

Traceback (most recent call last):
File "", line 3, in
import direct.directbase.DirectStart
ImportError: No module named direct.directbase.DirectStart

Here's the solution to that little problem:

1. Place the code in a particular directory.
2. In command prompt (for the Windows Platform), enter the following command:

ppython invokes Panda's python interpreter. It works better since it knows where exactly to look for the libraries.

I am tinkering the code to now achieve the same effect with the .egg meshes exported to Panda. Will post the results soon.

No comments: