Kivy 2.0.0 touch fires on_press events 2x on Raspberry Pi

177 views
Skip to first unread message

blake

unread,
Nov 30, 2021, 11:23:44 AM11/30/21
to Kivy users support
I have a problem with touch events with Kivy 2.0.0 on a Raspberry Pi. Every press on e.g. a button or on a file icon in the FileChooser is sent twice. It makes it impossible to browse though files and select the right file. I have searched this forum but did not find a solution (yet). I'm running:
  • Linux raspberrypi 5.10.63-v7l+ #1459 SMP Wed Oct 6 16:41:57 BST 2021
  • Python 3.9.2
  • Kivy 2.0.0
The problem occurs on 'touch_down'. When I press a button fast, I see the on_press() fired twice. If I press and hold, I see the same behaviour. So it happens on touch down, not on touch up.

The 'touch_down' and 'touch_up' functions are not implemented. It is just to illustrate what happens when pressing a button or icon on screen.



Robert

unread,
Nov 30, 2021, 12:10:02 PM11/30/21
to Kivy users support

blake

unread,
Nov 30, 2021, 1:58:56 PM11/30/21
to Kivy users support
Thank you for your swift answer. I tried that, but it did not help, unfortunately.

wolf...@gmail.com

unread,
Nov 30, 2021, 4:23:30 PM11/30/21
to Kivy users support
this issue is usually due to having more than one entry under the [input] section.
If you are running under XWindows then you just need mouse = mouse
if using a touch screen then you only need mtdev_%(name)s = probesysfs,provider=mtdev

If you have more than one entry then you will get an inout event from each device found under [input]

blake

unread,
Nov 30, 2021, 4:30:30 PM11/30/21
to Kivy users support
Yes! That solves it. Super big thank you @wolf...

wolf...@gmail.com

unread,
Nov 30, 2021, 4:40:28 PM11/30/21
to Kivy users support
the other entry under [input] would be %(name)s = probesysfs,provider=hidinput if you were using a usb mouse.

But the rule should be that only one is used, unfortunately this is unclear in the docs which show an example of all three being entered.

blake

unread,
Nov 30, 2021, 4:52:17 PM11/30/21
to Kivy users support
Just a general question: How do we do this if we have different Kivy apps, one with mouse control and another app with touch control? The kivy config file is system wide. 

Elliot Garbus

unread,
Nov 30, 2021, 7:04:37 PM11/30/21
to kivy-...@googlegroups.com

You can change the config dynamically in the kivy code using Config.set()

https://kivy.org/doc/master/api-kivy.config.html?highlight=config#applying-configurations

 

Note from the docs:  In order to avoid situations where the config settings do not work or are not applied before window creation (like setting an initial window size), Config.set should be used before importing any other Kivy modules. Ideally, this means setting them right at the start of your main.py script.

 

Because these configurations should be changed before importing any other kivy modules, I often put set configs in a separate file I call startupconfilg.py, and make the first line of my “main.py” file:

import startupconfig

--
You received this message because you are subscribed to the Google Groups "Kivy users support" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kivy-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kivy-users/b5905bc9-8691-49e5-a03d-50b4d4a34aeen%40googlegroups.com.

 

Reply all
Reply to author
Forward
0 new messages