From: Craig S. <cra...@ma...> - 2009-06-21 14:03:05
|
After several hours of staring, I discovered a bug in my code which caused the interaction loop to quit prematurely. After fixing that, interaction with multiple windows works fine. Sorry! Craig On Jun 20, 2009, at 12:58 PM, Bruce Sherwood wrote: > Puzzling and unfamiliar. Works fine for me on a MacBook with VPython > 5.11, MacPython 2.6.2, OSX 10.5.7. There shouldn't be any difference > in > this area between VPython 5.1 and 5.11. > > Could you please post a small test routine that fails for you? I > successfully ran the following: > > from visual.graph import * > scene.x = 0 > scene.y = 400 > scene.range = 4 > b = box() > y = gcurve(color=color.cyan) > pick = None > while 1: > rate(50) > if scene.mouse.events: > m = scene.mouse.getevent() > if m.drag: > dragpos = m.pickpos > pick = m.pick > elif m.drop: > pick = None > if pick: > newpos = scene.mouse.pos > if newpos != dragpos: > pick.pos += newpos-dragpos > dragpos = newpos > y.plot(pos=(newpos.x,newpos.y)) > > Independent of the graph issue, I did notice that on Windows I didn't > need the "rate(50)" but I did on the Mac, where otherwise dragging was > sluggish. > > Bruce Sherwood > > Craig A. Struble, Ph.D. wrote: >> Hello, >> >> I'm trying to develop an interactive application with two windows: >> one >> in which a user drags a sphere around; another which plots a graph >> (using gdisplay and gcurve). >> >> When I use only the display, I can drag the sphere around fine, using >> code similar to the toroid_drag.py example. When I add the graph >> display, my first window doesn't receive left mouse button events >> anymore and the sphere doesn't move. The order of window creation >> doesn't change anything. >> >> How can I have two windows and interactivity? I'm using VPython 5.1, >> MacPython 2.6.2, on OS X 10.5.7. >> >> Craig >> -- >> Craig A. Struble, Ph.D. | 369 Cudahy Hall | Marquette University >> Associate Professor of Computer Science | (414)288-3783 >> Director, Master of Bioinformatics Program | (414)288-5472 (fax) >> http://www.mscs.mu.edu/~cstruble | cra...@ma... >> >> >> ------------------------------------------------------------------------------ >> Are you an open source citizen? Join us for the Open Source Bridge >> conference! >> Portland, OR, June 17-19. Two days of sessions, one day of >> unconference: $250. >> Need another reason to go? 24-hour hacker lounge. Register today! >> http://ad.doubleclick.net/clk;215844324;13503038;v?http://opensourcebridge.org >> _______________________________________________ >> Visualpython-users mailing list >> Vis...@li... >> https://lists.sourceforge.net/lists/listinfo/visualpython-users >> -- Craig A. Struble, Ph.D. | 369 Cudahy Hall | Marquette University Associate Professor of Computer Science | (414)288-3783 Director, Master of Bioinformatics Program | (414)288-5472 (fax) http://www.mscs.mu.edu/~cstruble | cra...@ma... |