[Tkinter-discuss] Strange behavior with python 2.5

Michael Lange klappnase at web.de
Sun Nov 16 15:43:40 CET 2008

On Sat, 15 Nov 2008 19:41:39 -0200
"Guilherme Polo" <ggpolo at gmail.com> 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.


More information about the Tkinter-discuss mailing list