[Tkinter-discuss] Strange behavior with python 2.5

Guilherme Polo ggpolo at gmail.com
Sun Nov 16 22:21:34 CET 2008

On Sun, Nov 16, 2008 at 6:59 PM, Michael Lange <klappnase at web.de> wrote:
> On Sun, 16 Nov 2008 17:18:54 -0200
> "Guilherme Polo" <ggpolo at gmail.com> wrote:
>> On Sun, Nov 16, 2008 at 4:59 PM, Vasilis Vlachoudis
>> <Vasilis.Vlachoudis at cern.ch> wrote:
>> > Finally I didn't understand, is it a problem of Tkinter or Tk/Tcl?
>> It is not really a problem. But if you want to blame someone, go for
>> Python then.
> If you get unexpected and , if the software you write is supposed to run on
> different platforms, also unpredictable behavior like this I think it *is* a
> problem.

I meant more in these sense of the conversion raising some exception,
but it can be seen in that way too sure. But this doesn't depend on
the platform, all them will show this behaviour.

> (...)
>> >>
>> >
>> > 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.
> The amounts of bug reports I received before and after changing to
> wantobjects=False says it does.

Good for you then :)
It gets hard to continue arguing about this now, since you apparently
solved the question on your side and thus won't have real examples of
this problem, and why it couldn't be solved, anymore (or maybe you do,
so we can continue on this).

> The problem is that you never seem
> to know where the TclObjects appear on Python / Tk versions other than your own.
> So what else to do? Convert everything Tk returns to string?

No, like I said, who calls into _tkinter should know what kind of
object to expect so you do the conversion yourself. If you are going
to return the object to the user, then surely check if it is what you
are expecting it to be.

Now, I'm sure this can be improved in Python but you have to invest
some time on it.

> Adding "try...except TclError"
> everywhere? Do nothing and wait if people will send bug reports?
> Michael

-- Guilherme H. Polo Goncalves

More information about the Tkinter-discuss mailing list