0

I'm currently trying to write an Image Viewer, but the "Forward/Backward" Buttons on the mouse are not triggering any of the possible binds in tkinter.

I tried the binds:

<Key>, <KeyPress>, <ButtonPress>, <Return>

but none of them can detect the mouse clicks on the forward/backward button.

Has Python even the possiblity to detect them?

Edit:

The buttons are called XButtons and are hookable with PyHook or PyQt, but if I try to let them run in the background, they are lagging massively, any way to prevent that?

I'm currently trying to let this script run smoothly in the background without causing extreme lags

Edit:

Using wxPython with PyHook solved my problem, since Tkinter and PyHook is causing huge lags, which don't appear with wxPython

2
  • 1
    Tkinter: bind additional mouse buttons Commented Nov 7, 2015 at 11:04
  • found this already and was the reason why I mentioned the binds in the post, but it would suffice to trigger a callback with any lib out there, I'm not sure how it exactly works, but the forward button should at least send any signal to the frame Commented Nov 7, 2015 at 18:00

1 Answer 1

0

The answer may vary by platform, and also by mouse driver.

On my OSX device where I have a logitech mouse with a total of five buttons, the fourth and fifth buttons are considered buttons 4 and 5. For example, I can bind to <Button-4> and <Button-5>.

That might work for you, or your mouse driver might assign those buttons to something else.

Sign up to request clarification or add additional context in comments.

1 Comment

if it was the 4 and 5 key, it would've triggered by the <Button> event, tried it manually with <Button-4> and <Button-5>, but didn't work for me

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.