From: Bruce S. <bas...@un...> - 2002-06-17 12:50:19
|
From your description it sounds like you are creating arrows inside your main loop. Instead, create the arrows just once, before entering the main loop. Then as the magnetic field changes, continually alter the axis attributes of the arrows. Here's the basic outline: Barrow = arrow(pos=(x1,y1,z)) while 1: # calculate mag. field B as a vector Barrow.axis = scalefactor*B # alter the axis of the Barrow object For an example of this, see the VPython demo program toroid_drag.py. If on the other hand you create the arrow object inside the loop, each time that you create it the old one becomes a (visible) orphan on the screen, and the new arrow is displayed. And if you try to make this arrow invisible, the old orphaned arrow objects will still be visible, since the name "Barrow" has been removed from the old arrows and currently references the most recently created object. If I've misdiagnosed the problem, please show us the relevant portion of your program. Bruce Sherwood At 12:13 AM 02/06/17 -0400, Karim Diff wrote: >This question may have been addressed before, but I am >new to vpython and I have not found the answer so far: >I am drawing vectors representing the magnetic field surrounding a moving >charge but at every iteration my program draws the new vectors on top of >the previous ones. I would like to be able to draw only the current >vectors. Is there a way of "refreshing" the display as in Java? >I tried to tinker with the visible attribute of my vectors (trying to turn >"visible" on and off) but it did not work. >Thanks for any pointers. > >Karim Diff |