#81 Mouse status not updating

closed-accepted
nobody
None
5
2011-09-05
2011-09-04
Jim de Graff
No

The value of scene.mouse.button never changes. Try running the following:

from visual import *

scene.title = "Test"
status = label(text="test",color=(1,0,0),box=False)

while True:

rate(100)

stat = ("\nevents: %d") % (scene.mouse.events) \ + ("\nclicked: %d") % (scene.mouse.clicked) \ + ("\npos: %d,%d,%d") % (scene.mouse.pos.x,scene.mouse.pos.y,scene.mouse.pos.z)

if scene.mouse.button is None:
stat += "\nbutton: None"
else:
stat += "\nbutton: " + scene.mouse.button

status.text = stat

Discussion

  • Bruce Sherwood
    Bruce Sherwood
    2011-09-05

    • status: open --> closed-accepted
     
  • Bruce Sherwood
    Bruce Sherwood
    2011-09-05

    The problem is that the documentation is wrong. It should say to get the event, E = scene.mouse.getevent(), then look at E.button.