[Tkinter-discuss] Strange behavior with python 2.5

Vasilis Vlachoudis Vasilis.Vlachoudis at cern.ch
Sat Nov 15 21:53:45 CET 2008


Dear all,

The tkMessageBox.askquestion as also several other methods e.g 
Text.search have changed the return value with python 2.5 wrt to 2.4

Run the following test program (below) with python 2.4 answering yes on 
askquestion dialogs and change directory in the askdirectory
you will get (python 2.4, Tk/Tcl 8.4 Tkinter $Revision 50704$)
ans1= yes <type 'str'>
ans2= yes <type 'str'>

Run the same example with python 2.5 (Tk/Tcl 8.5 Tkinter $Revision: 50704 $)
ans1= yes <type 'unicode'>
ans2= yes <type '_tkinter.Tcl_Obj'>

First the ans1 is unicode instead of str and the second one after the 
askquestion is _tkinter.Tcl_Obj!

Also with python 2.4 tk/tcl 8.5, the Text.search now returns the 
_tkinter.Tcl_Obj instead of str regardless of opening the 
tkFileDialog.askdirectory()

Best Regards
Vasilis

# -------------- test program -----------
from Tkinter import *
import tkMessageBox
import tkFileDialog
root = Tk()
ans = tkMessageBox.askquestion("Yes/No","Answer YES")
print "ans1=",ans,type(ans)
d = tkFileDialog.askdirectory(title="Please change directory")
ans = tkMessageBox.askquestion("Yes/No","Answer YES")
print "ans2=",ans,type(ans)


More information about the Tkinter-discuss mailing list