Tkinter pack bug in Python 2.3

Frank Stajano fms27 at cam.ac.uk
Mon Nov 3 13:33:42 EST 2003


 >>frame = Frame(root, bg="lightBlue").pack(side=TOP, expand=1, fill=BOTH)
 >
 >
 >You are assigning the result of the pack() method, i. e. None, to frame
 >here, and consequently Canvas is constructed with None instead of a Frame
 >instance as the first argument.

Thanks for the explanation.

I was under the obviously mistaken impression that the result returned by 
the pack method was the widget being packed, precisely so as to make this 
kind of compact invocation chaining possible. If this was never so, I am 
not sure where I got this idea from!

One thing I know, it certainly was not from Perl, as the next poster 
insinuated. I wouldn't touch that with a barge pole.

Perhaps it was from misreading other people's code. In the now distant past 
I did several fun years of Tcl/Tk/[incr Tcl] before switching to Python, 
but these are my first steps with Tkinter.

   Frank (filologo disneyano) http://www-lce.eng.cam.ac.uk/~fms27/






More information about the Python-list mailing list