I thought I'd play around with vPython so I wrote a 3D breakout game (I used to have one on my Amiga and I haven't seen one for Windows). Everything is done except for one wee problem. I want to idle while waiting for the user to click the left mouse button. Because the user must still be able to move the paddle (to position the shot for a new ball), I can't just do a getclick or getevent (which pauses the loop). I tried
if newball: if myscene.mouse.clicked: do stuff
because events are not being cleared from the queue even if I do
myscene.mouse.events = 0
which is supposed to clear out any queued mouse events
Similarly I can't just idle until myscene.mouse.button = "left" because this attribute never seems to be updated as the following program will show
from visual import * myscene = display(title="test",width=500,height=320) status = label(text="test",color=(1,0,0)) while True: rate(100) if myscene.mouse.button is None: status.text = "None" else: status.text = myscene.mouse.button
On my machine (Windows 7 Pro, Active Python 188.8.131.52, vPython 5.71) the status stays frozen on "None". Is this a bug in vPython? Does anyone have a suggestion on either what I am doing wrong or how to work around the bug if I am not?