I'm still hammering away, and have found that when I change: class testWidget(Frame): def __init__(self, master): Frame.__init__(self) self.createWidgets() def createWidgets(self): Label(self,text="testWidget").grid() to: def __init__(self, master): Frame.__init__(self) self.x=master self.createWidgets() def createWidgets(self): Label(self.x,text="testWidget").grid()
It seems to work correctly. However my actual widget, an extended Frame widget, still doesn't work correctly. This seems to confirm what I thought about addressing the correct parent, but I still haven't figured it out completely. Unless someone can give me a clue, I guess I can keep modifying testWidget(Frame) to add the components of my original until I can see where it breaks down. On the surface it looks like I'm not passing the correct master reference to my frame. Bill William Gill wrote: > I have created a widget that extends Frame() and contains labels, > checkboxes, and entrys. I am trying to use tkSimpleDialog.Dialog to > create a modal display of this widget, but am running into some > (addressing) problems. My widget displays in the parent widget, not the > tkSimpleDialog.Dialog? I hope this snippet is enough to help, as my > actual code is really too hard to follow. > > class showtestWidget(tkSimpleDialog.Dialog): > def body(self,master): > Label(master,text="showPhoneNums").grid() > testWidget(self).grid() > > class testWidget(Frame): > def __init__(self, master): > Frame.__init__(self) > self.createWidgets() > def createWidgets(self): > Label(self,text="testWidget").grid() > > When the parent script instantiates showtestWidget() it should create a > transient dialog containing a label with the text "showPhoneNums". It > does, but the label containing the text "testWidget" is being created in > the parent widget, not the dialog. > > It seems obvious to me that I'm addressing the wrong parent somehow, > since the label (probably the testWidget) is being created, but in the > wrong place. > > I tried changing testWidget(self).grid() to testWidget(master).grid(), > just to see if that helped, but it made no difference. > > Can someone show me where I went wrong? > > Bill > > -- http://mail.python.org/mailman/listinfo/python-list