[issue10731] UnicodeDecodeError in OS X tkinter when binding to <MouseWheel>

Marc Culler report at bugs.python.org
Sat Dec 18 16:22:41 CET 2010


New submission from Marc Culler <culler at math.uic.edu>:

In OS X tkinter the "two-finger scroll" generates <MouseWheel> events.

The following code:

#### bug.py
import tkinter

def mouse_wheel(event):
    print('Mouse wheel event')

tk = tkinter.Tk()
list = tkinter.Listbox(tk)
list.bind('<MouseWheel>', mouse_wheel)
for n in range(20):
    list.insert(tkinter.END, str(n**n))
list.pack(fill=tkinter.BOTH, expand=1)
tk.mainloop()
####

often throws a UnicodeDecodeError exception with a traceback like the one shown below when you do a "two-finger scroll" in the window.

Traceback (most recent call last):
  File "bug.py", line 12, in <module>
    tk.mainloop()
  File "/Library/Frameworks/Python.framework/Versions/3.1/lib/python3.1/tkinter/__init__.py", line 1009, in mainloop
    self.tk.mainloop(n)
UnicodeDecodeError: 'utf8' codec can't decode byte 0x84 in position 1: unexpected code byte

The value of the byte changes from time to time, and sometimes it may be possible to scroll a few times without producing the error.

This problem did not occur on my Mandriva 2010.2 system.  I think it is specific to the Macintosh.  It might possibly be related to:
http://bugs.python.org/issue834351

----------
components: Tkinter
messages: 124287
nosy: culler
priority: normal
severity: normal
status: open
title: UnicodeDecodeError in OS X tkinter when binding to <MouseWheel>
type: crash
versions: Python 3.1

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue10731>
_______________________________________


More information about the Python-bugs-list mailing list