title: Python 3 unicode codec error binding mousewheel in tkinter
body: <p>Using Python 3.6/tkinter on MacOS, I created a frame within a canvas and bound a scrollbar to it. This all works fine. The problem is when I try to snag MouseWheel events when the cursor is in the scrollable frame. I set up a binding:</p>
  
  <pre><code>main_window.bind("&lt;MouseWheel&gt;",on_mousewheel)
  </code></pre>
  
  <p>and created a short dummy event handler:</p>
  
  <pre><code>def on_mousewheel(event):
      print(event.delta)
  </code></pre>
  
  <p>Every time I use the scroll wheel, Python responds with:</p>
  
  <pre><code>Traceback (most recent call last):
    File "/Users/Gary/IPPS/opendb.py", line 160, in &lt;module&gt;
      main_window.mainloop()
    File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/tkinter/__init__.py", line 1277, in mainloop
      self.tk.mainloop(n)
  UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte
  </code></pre>
  
  <p>Here is the code:</p>
  
  <pre><code>from tkinter import *
  
  def on_main_window_resize(event):
      canvas.configure(scrollregion=canvas.bbox('all'))
  
  def on_mousewheel(event):
      print(event.delta)
  
  main_window = Tk()
  main_window.bind("&lt;MouseWheel&gt;",on_mousewheel)
  canvas = Canvas(main_window, width=500, height=500)
  canvas.pack(side=LEFT, fill=BOTH, expand=YES)
  cust_scroll = Scrollbar(main_window, orient=VERTICAL, command=canvas.yview)
  cust_scroll.pack(side=RIGHT, fill=Y, expand=NO)
  cust_list = Frame(canvas)
  canvas['yscrollcommand'] = cust_scroll.set
  canvas.bind('&lt;Configure&gt;', on_main_window_resize)
  canvas.create_window((0,0), window=cust_list, anchor=NW)
  main_window.grid_columnconfigure(0, weight=1)
  main_window.grid_rowconfigure(0, weight=1)
  
  memberbuttons = list();
  for member in range(1,20):
      memberbutton = Button(cust_list, text="BUTTON", justify=LEFT, pady=2)
      memberbutton.pack(side=TOP, fill=X)
  main_window.mainloop()
  </code></pre>
  
  <p>Any ideas?</p>