From: Reinhard O. <old...@ma...> - 2010-09-23 20:33:50
|
Dear All! VPython is really agreat library that I love very much. But now I tried to make points dragable in a seemingly very simple way: from visual import * def Vmainloop(): while 1: if scene.mouse.events: ev=scene.mouse.getevent() if ev.drag: VdragEvent(scene.mouse.pos,scene.mouse.pick) def VdragEvent(pos,obj): obj.pos=pos def makePoint(pos): return sphere(pos=pos,radius=0.2,color=color.red) [A,B,C]=[makePoint((-3,1,1)),makePoint((3,1,1)),makePoint((0,5,1))] scene.autoscale=0 Vmainloop() However, this does not work. The points are draggable, but only a very small distance. After that, no further events are triggered. Obviously, after dragging it a bit, it is no longer picked. But this is strange because the position has been updated. Does anybody have a hint on this? Reinhard Oldenburg -- Prof. Dr. Reinhard Oldenburg Goethe-Universität Frankfurt Institut für Didaktik der Mathematik und Informatik Senckenberganlage 9 D-60325 Frankfurt/Main Telefon +49 (0)69 798 23770 Telefax +49 (0)69 798 22553 E-Mail old...@ma... WWW www.math.uni-frankfurt.de/~oldenbur |