Detect which mouse button was pressed in Kivy on Raspberry Pi

Viewed 676

I'm writing a multi-platform program in Python with Kivy which works on Linux, Windows and Raspberri Pi.

On Raspberry Pi I have a freshly-installed Raspbian Jessie Lite, with Kivy installed from scratch following the instructions on Kivy website.

The program utilizes keyboard and mouse input, with specific actions for different mouse buttons, including wheel rotation. No problems in Linux and Windows.

On Raspberry Pi, every part of the program works well, except for mouse input. First, the cursor was invisible, until I added this into Kivy's config.ini file:

[modules]
touchring = show_cursor=true
cursor = 1

Now, the remaining problem is, the program crashes when trying to read the button property of the click event inside on_touch_down() function (to determine which button was clicked), saying 'HIDMotionEvent' has no attribute button. Furthermore, mouse wheel rotation doesn't even register as a click event (it does on other systems).

It probably depends on provider, and the relevant lines in Kivy's config are these:

[input]
mouse = mouse,disable_multitouch
%(name)s = probesysfs,provider=hidinput

If I replace the provider with mtdev or mouse, then neither keyboard nor mouse work in the program.

Any idea if Kivy on Raspberry Pi supports detection of specific mouse buttons (including wheel rotation), and how to do it?

0 Answers
Related