2016-10-17 3 views
1

私のkvファイルでscroll_to関数を使用しています。私が望むように適切にスクロールしますが、マウスホイールを回すと、scroll_to()の前に戻ってきます。scroll_to()の動作

私のコードを改善するにはどうすればよいですか?私の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....... 

はあなたの助けをありがとう....

+0

バグですので、[repo](https://github.com/kivy/kivy/issues/)で問題を作りましょう。おそらく、スクロールの新しい変化に関係しているでしょう。 – KeyWeeUsr

答えて

0

を私は "解決策" を見つけるために管理:基本的には、 "コンテンツ" にscroll_typeを設定し、 と...画面上のどこかにクリック機能がある

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)