2

我正在 tkinter 中实现鼠标滚轮事件

def on_mousewheel(event,canvas):
    canvas.yview_scroll(event.delta,"units")

canvas.bind_all("<MouseWheel>", lambda event:on_mousewheel(event,canvas))

它给了我错误

UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte

我正在使用 MacOS。如果我拖动滚动条一切都很好。如果我尝试使用 Mac 触控板或其他鼠标滚动,tkinter 会关闭并出现上述错误

4

0 回答 0