|
If you're new to Python A VPython tutorial Pictures of 3D objects Choose a 3D object: Work with 3D objects: Windows, Events, & Files: What's new in Visual 5 VPython web site |
Click ExampleThis program displays a box (which automatically creates a window referred to as scene), then repeatedly waits for a mouse left click, prints the mouse position in the Python shell window, and displays a cyan sphere. A mouse click is defined as pressing and releasing the left mouse button with no motion of the mouse, so the sphere appears when you release the mouse button. from visual import * Copy this program into an IDLE window and run the program. Click outside the box and a cyan sphere appears where you click. If you click inside the box, nothing seems to happen. This is because the mouse click is in the xy plane, and the sphere is buried inside the box. If you rotate the scene and then click, you'll see that the spheres go into the new plane parallel to the screen and passing through scene.center. If you want all of the spheres to go into the xy plane, perpendicular to the z axis, change the latter part of the program like this: loc =
m.project(normal=(0,0,1)) Here is general mouse documentation. |
||