Finally I didn't understand, is it a problem of Tkinter or Tk/Tcl? In any case it breaks the behavior of many programs. Moreover returning a different object after calling askdirectory it means that there is a problem somewhere that changes the default behavior. Apart from type casting with str() what is the correct solution?
Vasilis -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Guilherme Polo Sent: Sunday, 16 November 2008 17:04 To: Michael Lange; tkinter-discuss@python.org Subject: Re: [Tkinter-discuss] Strange behavior with python 2.5 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 _______________________________________________ Tkinter-discuss mailing list Tkinter-discuss@python.org http://mail.python.org/mailman/listinfo/tkinter-discuss