Skip to content

moveMouseToPosition() doesn't move mouse to correct position #10

@zkghost

Description

@zkghost

I've got a setup with 3 monitors where my primary monitor is in the middle. I have a loop that's something like:

def get_mouse_position():
    pos = autohotpy.getMousePosition()
    return {'x': pos[0], 'y': pos[1]}

while True:
    time.sleep(0.01)
    mouse = get_mouse_position()
    message = "\rMouse is at x: {}, y: {}".format(mouse['x'], mouse['y']) + ' ' * 10
    print(message, end='', flush=True)
    sys.stdout.flush()

This shows that on my primary monitor, the mouse coordinates range from:
x:0 -> x:1919
y:0 -> y:1199
Which makes sense, considering the monitor is 1920 x 1200.

If I go to my left-most monitor, the x values returned are negative, from -1 to -3840 which makes sense because it is a 4k monitor. The y values only go to 864 though, which is odd.. Not sure if that is due to UI scaling?

Anyways, given all this, if I do:

autohotpy.moveMouseToPosition(500, 500)

I would expect it to land in the same spot where my loop above would show 500,500.

What actually happens is the mouse ends up on my leftmost monitor at -3040, 360.

Do you have any idea why this is happening?

This is on a Windows 10 environment.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions