inconsistent mouse movement issue using code

Gtuner IV general support. Operation, questions, updates, feature request.

inconsistent mouse movement issue using code

Postby ta_trainer » Tue Dec 14, 2021 11:36 pm

I am trying to control the mouse using python using:
win32api.mouse_event(win32con.MOUSEEVENTF_MOVE, x, y, 0, 0)
where x and y are relative coordinates, for example, If I need to move the mouse x 10 pixels to the right, I would have x = 10

I am using titan 2 and gtuner mouse and keyboard capture.
I know due to the xyconverter, my inputs are not going to be one to one match, so may be when I move the mouse by 100 using the method above, it would only move maybe 50 pixels on the screen.

so I figured I should capture this information in a table and use it as a translator, so now If I need to move 50 pixels on the screen, then my lookup table woudl suggest sending 100 to win32api.mouse_event

The issue I am having is inconsistency, the table shows my experiments when moving the mouse by x value and what I get on the screen (how many pixels it really moved)

mouse_x_move_value vs pixels_moved_on_screen
250 47
240 41
230 20
220 37
210 30
200 13
190 27
180 15
170 43
160 15
150 23

does anyone know why I am getting this behavior and if there is any better solution?

thank you
User avatar
ta_trainer
Private First Class
Private First Class
 
Posts: 2
Joined: Tue Dec 14, 2021 11:18 pm

Re: inconsistent mouse movement issue using code

Postby bazzd » Wed Dec 15, 2021 7:11 pm

What about type hinting?

Code: Select all
win32api.mouse_event(win32con.MOUSEEVENTF_MOVE, int(x), int(y), 0, 0) 


And could you please show more of the code? Maybe you should round those values?
User avatar
bazzd
Sergeant
Sergeant
 
Posts: 6
Joined: Thu Dec 09, 2021 7:40 pm


Return to Gtuner IV Support

Who is online

Users browsing this forum: No registered users and 97 guests