[Tkinter-discuss] Python 3.2 and binding Mousewheel on Mac

Kevin Walzer kw at codebykevin.com
Sun Apr 22 17:00:01 CEST 2012

Hi Mick,

On 4/22/12 8:51 AM, Michael O'Donnell wrote:
> It may also be an issue that
> affects Python because _tkinter still uses the older Tcl_CreateCommand
> interface rather than the newer Tcl_CreateObjCommand.  The same Tcl
> behavior is observed with Python 2.7 _tkinter.c but there the bogus
> arguments are translated using PyString_FromString which is unaffected
> by the garbage arguments.  It might be possible to workaround this
> problem in _tkinter but the next step is to open a Tcl/Tk issue
> against the Cocoa implementation and push for a proper fix there.

I did read all the notes that were on the various bug reports, including 
the portions above that you quote, and I also attempted to reproduce the 
bug with all the installations at my disposal.

To reiterate:

1. According to all available reports, the bug is only visible in a 
specific combination of Python and Tk: specifically, Python 3.x (with 
its new under-the-hood Unicode support everywhere) and Tk-Cocoa.

2. Ned's debugging isolated the specific point in tkinter.c where the 
bug appears.

3. Neil identified a possible fix for the bug on the Python side on the 

4. The bug is not visible when accessed from Tcl/Tk. The two-finger 
scrolling works as expected.

I'm able to fix Tkinter bugs when they are also accessible from Tcl/Tk; 
the fix on the Tk side is automatically picked up by Tkinter. The recent 
text input bug patch I committed is an example of this. Adrian Robert, 
who identified the bug in a Tcl/Tk application he develops, authored the 
patch, which I then committed, and which then fixed several related bug 
reports from the Python community.

This case, however, is different. I fully accept Tk is returning some 
sort of output that Python 3.x has difficulty handling, but because that 
output produces no user-visible errors on the Tcl side of the bridge 
(and Tcl, remember, is Tk's native language), I am very uncomfortable 
with diving into to Tk's internals to make changes. Because there are no 
reproducible errors from Tcl itself, it is not even clear to me what 
changes should be made.

In order to call this a bug in Tk itself rather than a bug in Tkinter, I 
need someone to put together a Tcl script that reproduces the issue. 
Then I can proceed with investigating how to fix it. That's how we 
proceeded with the text input bug. In this case, however, all evidence 
suggests that the bug occurs at the level of Tkinter/Tk interaction, and 
all evidence also suggests that a workaround or fix can--and, most 
likely should--be implemented on the Python side of the bridge.


Kevin Walzer
Code by Kevin

More information about the Tkinter-discuss mailing list