#1
|
|||
|
|||
set mouse position
Hi all,
I would like to know if its is possible to set the mouse position??? I found the method viz.mousepos and have assigned it the value of the wiimote coordinates however the cursor does not move. If you can help please post a response. ALyssa |
#2
|
|||
|
|||
The following script shows how to use a wiimote to control the mouse movement and simulate mouse button presses:
Code:
import viz import win32api import win32con viz.go() #Create wii extension wii = viz.add('wiimote.dle') #Connect to wiimote wiimote = wii.addWiimote() if not wiimote.valid(): sys.exit() #Use wiimote button B to simulate left mouse click def SimulateMouseButton(button): win32api.mouse_event(button,0,0,0) vizact.onsensordown(wiimote,wii.BUTTON_B,SimulateMouseButton,win32con.MOUSEEVENTF_LEFTDOWN) vizact.onsensorup(wiimote,wii.BUTTON_B,SimulateMouseButton,win32con.MOUSEEVENTF_LEFTUP) #Use wiimote IR sensor position to simulate mouse movement def SimulateMouseMove(): x,y = wiimote.posIR win32api.mouse_event(win32con.MOUSEEVENTF_ABSOLUTE|win32con.MOUSEEVENTF_MOVE,int(65535*x),int(65535*(1.0-y)),0) vizact.ontimer(0,SimulateMouseMove) |
Thread Tools | |
Display Modes | Rate This Thread |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
writing joystick position to a data file | Saz | Vizard | 3 | 12-17-2008 05:18 AM |
default start position | erchrastil | Vizard | 2 | 06-23-2008 08:15 AM |
Avatar always returns in initial position | pattie | Vizard | 2 | 08-31-2006 08:15 PM |
Mouse problem | steve | Vizard | 7 | 07-14-2005 03:01 PM |
Halting mouse view-transforms | FlyingWren | Vizard | 1 | 10-01-2003 05:29 PM |