What are the Tkinter events for horizontal edge scrolling (in Linux)?

后端 未结 2 1422
隐瞒了意图╮
隐瞒了意图╮ 2020-12-22 08:32

I have a Python Tkinter Text widget with scrollbars. I would like to define my own method for using horizontal edge scrolling on my laptop\'s touchpad. However, I don\'t kno

2条回答
  •  情话喂你
    2020-12-22 09:17

    I just wanted to add on that on MacOS as no where tells this and I spent quite a bit of time experimenting and searching. The event.state changes from 0 for vertical mouse scroll and 1 for horizontal mouse scroll.

    def mouseScroll(event):
        if event.state == 0:
            canvas.y_viewscroll(-event.delta, "units")
        elif event.state == 1: # you can use just an else as it can only be 0 or 1
            canvas.x_viewscroll(-event.delta, "units")
    

提交回复
热议问题