On Mar 3, 10:40 pm, Marc 'BlackJack' Rintsch <bj_...@gmx.net> wrote: > On Tue, 03 Mar 2009 18:06:56 -0800, chuck wrote: > > I am learning python right now. In the lesson on tkinter I see this > > piece of code > > > from Tkinter import * > > > class MyFrame(Frame): > > def __init__(self): > > Frame.__init__(self) > > self.grid() > > > My question is what does "self.grid()" do? I understand that the grid > > method registers widgets with the geometry manager and adds them to the > > frame > > Not "the frame" but the container widget that is the parent of the widget > on which you call `grid()`. In this case that would be a (maybe > implicitly created) `Tkinter.Tk` instance, because there is no explicit > parent widget set here. Which IMHO is not a good idea. > > And widgets that layout themselves in the `__init__()` are a code smell > too. No standard widget does this, and it takes away the flexibility of > the code using that widget to decide how and where it should be placed. > > Ciao, > Marc 'BlackJack' Rintsch
I think I understand what you're saying! How would you recommend I go about this? How do I create an explicit parent? What exactly is meant by "widgets that layout themselves"- what is the right way to do this? Thanks! -- http://mail.python.org/mailman/listinfo/python-list