33 the 3 d graphics scene by default the sphere is at

This preview shows page 2 - 5 out of 11 pages.

3.3 The 3-D graphics scene By default the sphere is at the center of the scene, and the “camera” (that is, your point of view) is looking directly at the center. Hold down both mouse buttons and move the mouse up and down to make the camera move closer or farther away from the center of the scene. (This may differ on Macintosh or Linux machines.) Hold down the right mouse button alone and move the mouse to make the camera “revolve” around the scene, while always looking at the center. (This may differ on Macintosh or Linux machines.) When you first run the program, the coordinate system has the positive x direction to the right, the positive y direction pointing up, and the positive z direction coming out of the screen toward you. You can then rotate the camera view to make these axes point in other directions. 2
Image of page 2

Subscribe to view the full document.

3.4 The Python Shell window is important – Error messages appear here IMPORTANT: Arrange the windows on your screen so the Shell window is always visible as in the figure below. DO NOT CLOSE THE SHELL WINDOW. KILL the program by closing only the graphic display window. The second new window that opened when you ran the program is the Python Shell window. If you include lines in the program that tell the computer to print text, the text will appear in this window. Use the mouse to make the Python Shell window smaller, and move it to the lower part of the screen. Keep it open when you are writing and running programs so you can easily spot error messages, which appear in this window. Make your edit window small enough that you can see both the edit window and the Python Shell window at all times. Do not expand the edit window to fill the whole screen. You will lose important information if you do! To kill the program, close only the graphics window. Do not close the Python Shell window 3.5 Error messages: Making and fixing an error To see an example of an error message, let’s try making a spelling mistake: Change the second statement of the program to the following: from bisual import * Run the program. Notice you get a message in red text in the Python Shell window. The message gives the filename, the line where the error occurred, and a description of the error (in this case ImportError: No module named bisual ). 3
Image of page 3
Read error messages top down: The top line contains the information about the location of the error. Correct the error in the program. Whenever your program fails to run properly, look for a red error message in the Python Shell window. Even if you don’t understand the error message, it is important to be able to see it, in order to find out that there is an error in your code. This helps you distinguish between a typing or coding mistake, and a program that runs correctly but does something other than what you intended. Return the second statement to from visual import * 3.6 Changing “attributes” (position, size, color, shape, etc.) of an object: Now let’s give the sphere a different position in space and a radius.
Image of page 4

Subscribe to view the full document.

Image of page 5
You've reached the end of this preview.
  • Spring '10
  • Jarrio
  • Physics, vpython, tennis ball

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern