Please , help with button on_press event misplacement

143 views
Skip to first unread message

alessandro bonvicini

unread,
Apr 21, 2017, 2:32:19 AM4/21/17
to kivy-...@googlegroups.com
HI all, 
i am totally new to kivy ,so please don't blame. 
I tried a simple example ,  one column and one row  of buttons. ON windows 8.1 desktop with mouse it works well, as expected: every button receive and manage his own on_press. BUT when I place the code on a hp window 8 hp 900 touch tablet with the SAME python installation and kivy version the app exibits a strange behaviour.

 The buttons that reacts  to the on_press event is not that one i press, BUT the next beside, on the left. And so is , of course, for the callback. THe callback invoked is that of the nearest button, on the right side, not that one binded to the button i press. 
Like if the sensitive surface of the button would be shifted to the right of a certain number of pixel.

No one error , nor suspicious log message...only like if the touchscreen would not calibrated....

But obviousliy the tablet works well out of the kivy app.
What can i do to correct this behaviour ? Is there something that can be done ? No one had this problems?
THank a lot in advance
Alessandro

Fari Tigar

unread,
Apr 21, 2017, 6:24:39 AM4/21/17
to Kivy users support
Before we go into any details: let us see the source code.

alessandro bonvicini

unread,
Apr 21, 2017, 8:22:33 AM4/21/17
to Kivy users support


Il giorno venerdì 21 aprile 2017 12:24:39 UTC+2, Fari Tigar ha scritto:
Before we go into any details: let us see the source code.

 
OK, thank you .THe source code is the following borrowed from  the net
!python
from kivy.app import App
from kivy.uix.tabbedpanel import TabbedPanel
from kivy.properties import ObjectProperty
from kivy.lang import Builder

Builder.load_string('''
<RootWidget>:
carousel: carousel
do_default_tab: False
Carousel:
on_index: root.on_index(*args)
id: carousel
Button:
text: 'Slide one'
tab: tab1
Button:
text: 'Slide Two'
tab:tab2
Button:
text: 'Slide three'
tab: tab3

TabbedPanelItem:
id: tab1
text: 'tab1'
slide: 0
TabbedPanelItem:
id: tab2
text: 'tab2'
slide: 1
TabbedPanelItem:
id: tab3
text: 'tab 3'
slide: 2
''')

class RootWidget(TabbedPanel):

def on_index(self, instance, value):
tab = instance.current_slide.tab
if self.current_tab != tab:
self.switch_to(tab)

def switch_to(self, header):
# we have to replace the functionality of the original switch_to
self.current_tab.state = "normal"
header.state = 'down'
self._current_tab = header
# set the carousel to load the appropriate slide
# saved in the screen attribute of the tab head
self.carousel.index = header.slide


class MainApp(App):

def build(self):
return RootWidget()


if __name__ == '__main__':
MainApp().run()
 


I tried to make a sort of postporecess calibration with

[input]
mytouch=wm_touch

[postprocess:calibration]
mytouch=xoffset=10,yooffset=10 

(tried many other value (0.1, 0.2 etc) to understand ho w this option works
but without any luck.

I start the window in 800x600 as by config.ini but the widget (labels,button) reacts only on the 2/3 left area of the widget and calling the callback of the nearest widget.


Again , thank a lot for your interest in my problem . If i cannot resolv this problem i'll must give up with kivy and would be really
regert cause it seems so cool.
Alessandro


alessandro bonvicini

unread,
Apr 21, 2017, 11:08:52 AM4/21/17
to Kivy users support
I tried again with other simple example, scrollview.py, the latest python 3.6.1 and latest kivy 1.9.2.dev0. It is always the same: the event on_press is triggered in a way that seems like a touch viewport is shifted  some pixel to the left and to the bottom
......

 

alessandro bonvicini

unread,
Apr 26, 2017, 2:16:20 AM4/26/17
to Kivy users support
......
Ha all,
may you help with the problem above, please? Do you have any ideas or suggestions to try?
Thank in advance
Alessandro
 

alessandro bonvicini

unread,
Apr 26, 2017, 10:21:14 AM4/26/17
to Kivy users support



Hi all,
really I need your help to address that problem above, otherwise I 'll be constrained to switch to wpf or some kind of microsoft tecnology. And i do not want ....
Please may someone give some support?
Thanks a lot
ALessandro
 
 

Geekademy

unread,
Apr 26, 2017, 1:01:13 PM4/26/17
to kivy-...@googlegroups.com
I ran this code on Linux and it seems to work fine. See screenshot.

Are you on Windows? Using a mouse? Maybe there is some odd mouse/trackpad
software causing a problem?

Have you tried running this on another machine, with standard input drivers?
screenshot.png

alessandro bonvicini

unread,
Apr 27, 2017, 1:35:43 PM4/27/17
to Kivy users support
HI , 
it works very well on windows 8.1 desktop  only whith the mouse, where i develop my software.
Then i transfer it on hp 900 tablet with windows 8 and touchscreen (without mouse), the deploy platform, and then it ceased to work. 

Everything (software version etc) seems the same from desktop to  tablet except that the tablet is touch and without the mouse .

I did not change anythings in the config.ini (wm_touch end so on) . Only i tryed to change the postprocess:calibration directvie move the touch area on the buttons, but without any success.  
 I repeat on windows desktop with the mouse the app works well , on windows tablet without the mouse the button events are totally mis-placed
. I don't know what to do ....i do not have another touch tablet to try....
Please  give me a suggestion....i really really appreciate your works and i do not want give up with kivy .....



 

alessandro bonvicini

unread,
May 2, 2017, 2:33:23 AM5/2/17
to Kivy users support
HI all,
is there someone that can give a hints on my problem, please?
I am stucked with this ....

Geekademy

unread,
May 2, 2017, 4:20:04 PM5/2/17
to kivy-...@googlegroups.com
Don't have any more information, but I'd definitely try on a different tablet,
and an Android if possible.
Reply all
Reply to author
Forward
0 new messages