[Tkinter-discuss] Python2.5.1+Tkinter+Tile0.8.2

Guilherme Polo ggpolo at gmail.com
Mon Jan 12 22:57:58 CET 2009


>> Just found it. If you have the privilege of being able to run an
>> own-compiled-version of Python (or, if possible, just update to Python
>> 2.6), you could apply the following patch:
>> http://svn.python.org/view/python/trunk/Modules/_tkinter.c?rev=59653&view=diff&r1=59653&r2=59652&p1=python/trunk/Modules/_tkinter.c&p2=/python/trunk/Modules/_tkinter.c
>>
>> That one wasn't backported to python 2.5, but I also don't remember
>> how to exactly hit the bug -- but will try reproducing it here (this
>> also remembers me of going back to finish the another python <->
>> tcl/tk bridge).
>>
>
> Ah, yes:
>
> import Tkinter
>
> text = Tkinter.Text()
> text.insert('end', 'hi there')
>
> def test(x):
>    print x, type(x), "< bad"
>
> text.tk.createcommand("test", test)
> text.tk.call("test", text.bbox('1.0'))
>
> x = text.bbox('1.0')
> print x, type(x)
>
> This is specially problematic in IDLE, but can affect other code too.
> The problem is that bbox is supposed to return a tuple in Python,
> which it returns, but then _tkinter (in Python 2.5) is not doing
> proper object conversions in callbacks and you end up getting a string
> in the example.
>

Eh.. that wasn't the actual problem, give me some time :P


-- 
-- Guilherme H. Polo Goncalves


More information about the Tkinter-discuss mailing list