On Sun, Nov 16, 2008 at 12:43 PM, Michael Lange <[EMAIL PROTECTED]> wrote:
> On Sat, 15 Nov 2008 19:41:39 -0200
> "Guilherme Polo" <[EMAIL PROTECTED]> wrote:
>
>>
>> When you get a _tkinter.Tcl_Obj it means _tkinter wasn't able to
>> detect and convert a received tcl object to a python object. When this
>> happens the best you can do is get the string representation of the
>> object by doing str(ans2) and then convert the value yourself (if you
>> want to convert it to something else different than a string).
>>
>> With Tcl/Tk 8.5 and the current _tkinter you will see this happening
>> very often, as tcl/tk now shares objects as much as it can. _tkinter
>> checks for some specific tcl types but since it may receive any kind
>> of object, like a pixel object, or bytecode object which are part of
>> tcl (which happens to contain the same representation, that is why
>> they got shared) it ends up returning this generic Tcl_Obj.
>>
>
> I also found this behavior quite often with Tk-8.4 on several linux systems,
> in fact it seemed to me like it is impossible to predict when it will occur
> so unfortunately the only thing which seems to work reliably is setting
> Tkinter.wantobjects to False.
>

Setting wantobjects to False is broken in py3k tho.

It incurs performance penalty too, since you will be working with
strings only and objects won't be shared. At the same time it saves
some time in not needing to do any transformations, or any extra
attempts to transform, since it will always be a string but I don't
believe this gain shadows the loses.

> Michael
> _______________________________________________
> Tkinter-discuss mailing list
> Tkinter-discuss@python.org
> http://mail.python.org/mailman/listinfo/tkinter-discuss
>



-- 
-- Guilherme H. Polo Goncalves
_______________________________________________
Tkinter-discuss mailing list
Tkinter-discuss@python.org
http://mail.python.org/mailman/listinfo/tkinter-discuss

Reply via email to