View Single Post
  #1  
Old 02-15-2011, 12:58 AM
Albert Russel Albert Russel is offline
Member
 
Join Date: Jun 2009
Location: Nijmegen, the Netherlands
Posts: 3
Mouse pointer problem

Hi,

In one of my programs I want a DropList to appear during a run and choose an item and then hide the list and the mouse pointer again. It all works fine except that the mouse will not go away until I move it after I disabled it. I tried viz.sendEvent(viz.MOUSE_MOVE_EVENT) to simulate a mouse movement but the pointer only disappears after a real mouse movement. Is it possible to hide the mouse without physically moving it?

Thanks in advance, Albert


Code:
import viz
import vizshape 

viz.go()

vizshape.addGrid()
viz.clearcolor(viz.GRAY)

def enableMouse():
      viz.mouse(viz.ON)
      viz.cursor(viz.ON)
      viz.mouse.setVisible(viz.ON)

def disableMouse():
      viz.mouse(viz.OFF)
      viz.cursor(viz.OFF)
      viz.mouse.setVisible(viz.OFF)


drop = viz.addDropList()
drop.setPosition(0.5, 0.5)
drop.addItems(["a", "b", "c"])
drop.visible(viz.OFF)

disableMouse()

def handleKey(key):
	global drop
	
	if key == 'x':
		drop.visible(viz.ON)
		enableMouse()
	elif key == 'y':
		drop.visible(viz.OFF)
		disableMouse()
		viz.sendEvent(viz.MOUSE_MOVE_EVENT) # does not work, I must move the real mouse to make the pointer go away

		
viz.callback(viz.KEYBOARD_EVENT, handleKey)
Reply With Quote