Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mouse Listener: Horizontal Scroll returns change in dy (not dx) #608

Open
asmith26 opened this issue Aug 24, 2024 · 0 comments
Open

Mouse Listener: Horizontal Scroll returns change in dy (not dx) #608

asmith26 opened this issue Aug 24, 2024 · 0 comments

Comments

@asmith26
Copy link

asmith26 commented Aug 24, 2024

Description
When I use a mouse listener and horizontally scroll, the callback returns a change in dy (not dx).

Platform and pynput version
Linux Mint 22 (based on Ubuntu 24.04), pynput==1.7.7

Full conda envinronment.yaml
name: pynput
channels:
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=conda_forge
  - _openmp_mutex=4.5=2_gnu
  - bzip2=1.0.8=h4bc722e_7
  - ca-certificates=2024.7.4=hbcca054_0
  - ld_impl_linux-64=2.40=hf3520f5_7
  - libexpat=2.6.2=h59595ed_0
  - libffi=3.4.2=h7f98852_5
  - libgcc-ng=14.1.0=h77fa898_0
  - libgomp=14.1.0=h77fa898_0
  - libnsl=2.0.1=hd590300_0
  - libsqlite=3.46.0=hde9e2c9_0
  - libuuid=2.38.1=h0b41bf4_0
  - libxcrypt=4.4.36=hd590300_1
  - libzlib=1.3.1=h4ab18f5_1
  - ncurses=6.5=h59595ed_0
  - openssl=3.3.1=hb9d3cd8_3
  - pip=24.2=pyhd8ed1ab_0
  - python=3.12.5=h2ad013b_0_cpython
  - readline=8.2=h8228510_1
  - setuptools=72.2.0=pyhd8ed1ab_0
  - tk=8.6.13=noxft_h4845f30_101
  - tzdata=2024a=h0c530f3_0
  - wheel=0.44.0=pyhd8ed1ab_0
  - xz=5.2.6=h166bdaf_0
  - pip:
      - evdev==1.7.1
      - pynput==1.7.7
      - python-xlib==0.33
      - six==1.16.0

To Reproduce

from pynput import mouse

def on_scroll(x, y, dx, dy):
    print(f"dx={dx}, dy={dy}")

# Collect events until released
with mouse.Listener(on_scroll=on_scroll) as listener:
    listener.join()

I'm finding this prints:

dx=0, dy=1   # when I scroll up (CORRECT)
dx=0, dy=-1  # when I scroll down (CORRECT)
dx=0, dy=1   # when I scroll left (INCORRECT, should be dx=1, dy=0)
dx=0, dy=-1  # when I scroll right (INCORRECT, should be dx=-1, dy=0)

Thanks for any help, and this amazing lib! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant