W
William Gill
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
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