Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/321.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 滚动到()行为_Python_Kivy - Fatal编程技术网

Python 滚动到()行为

Python 滚动到()行为,python,kivy,Python,Kivy,我正在使用scroll_在我的kv文件中运行。它可以按照我的要求正确滚动,但如果我转动鼠标滚轮,它将跳回原来的位置,然后滚动到() 有什么想法吗?我如何改进我的代码 我的kv文件的snipplet: MyButton: text: 'jump' on_release: scroll_content.scroll_to(jump_id_2, padding=0, animate=True) ScrollView: id: scroll_content blah,

我正在使用scroll_在我的kv文件中运行。它可以按照我的要求正确滚动,但如果我转动鼠标滚轮,它将跳回原来的位置,然后滚动到()

有什么想法吗?我如何改进我的代码

我的kv文件的snipplet:

MyButton:
    text: 'jump'
    on_release: scroll_content.scroll_to(jump_id_2, padding=0, animate=True)

ScrollView:
    id: scroll_content
    blah, blah, blah.......

    # values of the devices
    GridLayout:

        BoxLayout:
            id: jump_id_0
            blah, blah, blah.......

        BoxLayout:
            id: jump_id_1
            blah, blah, blah.......

        BoxLayout:
            id: jump_id_2
            blah, blah, blah.......
感谢您的帮助……

我设法找到了一个“解决方案”:基本上您将滚动类型设置为“内容”, 然后点击屏幕上的某个地方

MyButton:
    text: 'jump'
    on_release: scroll_content.scroll_to(jump_id_2, padding=0, animate=True); app.click(200)

ScrollView:
    id: scroll_content
    scroll_type: ['content']
    blah, blah, blah.......

    # values of the devices
    GridLayout:

        BoxLayout:
            id: jump_id_0
            blah, blah, blah.......

        BoxLayout:
            id: jump_id_1
            blah, blah, blah.......

        BoxLayout:
            id: jump_id_2
            blah, blah, blah.......
其中,单击功能为:

def click(self, shift):
"""Click on the screen."""
        pt = POINT()
        ctypes.windll.user32.GetCursorPos(ctypes.byref(pt))
        ctypes.windll.user32.SetCursorPos(pt.x, pt.y + shift)
        ctypes.windll.user32.mouse_event(2, pt.x, pt.y + shift, 0, 0)
        ctypes.windll.user32.mouse_event(4, pt.x, pt.y + shift, 0, 0)
        ctypes.windll.user32.SetCursorPos(pt.x, pt.y)
我设法找到了一个“解决方案”:基本上你将滚动类型设置为“内容”, 然后点击屏幕上的某个地方

MyButton:
    text: 'jump'
    on_release: scroll_content.scroll_to(jump_id_2, padding=0, animate=True); app.click(200)

ScrollView:
    id: scroll_content
    scroll_type: ['content']
    blah, blah, blah.......

    # values of the devices
    GridLayout:

        BoxLayout:
            id: jump_id_0
            blah, blah, blah.......

        BoxLayout:
            id: jump_id_1
            blah, blah, blah.......

        BoxLayout:
            id: jump_id_2
            blah, blah, blah.......
其中,单击功能为:

def click(self, shift):
"""Click on the screen."""
        pt = POINT()
        ctypes.windll.user32.GetCursorPos(ctypes.byref(pt))
        ctypes.windll.user32.SetCursorPos(pt.x, pt.y + shift)
        ctypes.windll.user32.mouse_event(2, pt.x, pt.y + shift, 0, 0)
        ctypes.windll.user32.mouse_event(4, pt.x, pt.y + shift, 0, 0)
        ctypes.windll.user32.SetCursorPos(pt.x, pt.y)
这是一个bug,在中制造问题。这可能与滚动的新变化有关。这是一个bug,在中制造问题。这可能与滚动的新变化有关。