kivy: Scrollview not working properly on Lenovo Yoga 920 W10

Versions

  • Python: 3.73
  • OS: Windows10
  • Kivy: 1.11.1
  • Kivy installation method: pip installed in the venv

Description

Scrollview not working properly on Lenovo Yoga 920 W10: using the touchpad to scroll down, scrolls up. Using a mouse wheel works as expected, using touch works as expected. The touchpad does not scroll properly.

Code and Logs

# Spinner and Scrollview tests. Scrollup does not work properly with a trackpad.

from kivy.app import App
from kivy.lang import Builder
from kivy.metrics import dp
from kivy.uix.spinner import Spinner

kv = '''
BoxLayout:
    orientation: 'vertical'
    BoxLayout:  # Line 1
        size_hint_y: 1
        BankSpinner:
            values: ['Bank: ' + str(n) for n in range(1,31)]
            text: 'Bank Select'
    ScrollView:
        size_hint_y:3
        do_scroll_x: False
        do_scroll_y: True
        scroll_type: ['bars', 'content']
        bar_width: 20
        Label:
            size_hint_y: None
            height: self.texture_size[1]
            text_size: self.width, None
            padding: 10, 10
            text: 'really some amazing text\\n' * 100    
    
    BoxLayout:
        size_hint_y: 8
'''


class BankSpinner(Spinner):
    def __init__(self, **kwargs):
        super().__init__(**kwargs)
        self.dropdown_cls.max_height = 10 * dp(48)

    def on_touch_up(self, touch):
        print(f'touch up:{touch}, touch.device: {touch.device} {touch.profile} ')
        if 'button' in touch.profile:
            print(f'button: {touch.button}')
        return super().on_touch_up(touch)

    def on_touch_move(self, touch):
        print(f'touch move:{touch}, touch.device: {touch.device}')
        return super().on_touch_move(touch)

    def on_touch_down(self, touch):
        print(f'touch down:{touch}, touch.device: {touch.device}')
        return super().on_touch_down(touch)


class SpinnerTestApp(App):

    def build(self):
        return Builder.load_string(kv)


SpinnerTestApp().run()

Additionally under Inclement’s direction I instrumented window_sdl2.py in _mainloop() scrolling on the touchpad reports mousewheelup if the scroll gesture is up or down. In the section that starts, ‘elif action.startswith(‘mousewheel’):’ x and y are always reported as zero when using the scrollup or scroll down gesture on the trackpad.

The attached log is the result of opening the app, scrolling down and then scrolling up with the trackpad. spinnertest.txt

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 2
  • Comments: 29 (14 by maintainers)

Commits related to this issue

Most upvoted comments

Indeed the line i proposed was slightly wrong, @probablyfine is correct, thank you both for confirming the fix works for you 😃. The PR will do a slightly different change to avoid dispatching the event at all, but the spirit is the same, this workaround is still fine until the fix is shipped in next release.

When you say “using the touchpad to scroll down, scrolls up” i assume you mean “putting two fingers on the touchpad, and moving them up” (i think is now the default in windows10 as in osx?) I think we are (ironicaly) still implementing the more traditional way (of before touchscreen became ubiquitous), maybe we could check the os preference and invert the direction depending on it.