[PyQt] Child Windows

Phil Thompson phil at riverbankcomputing.co.uk
Fri Oct 12 08:43:30 BST 2007

On Friday 12 October 2007, Lawrence Shafer wrote:
> I'm having trouble getting my brain wrapped around all this gooey stuff!
> I want to show a child window, but have definitely NOT figured out the
> proper way to do it. Here's what shows the window right now, the problem
> being it is a seperate top level window. I'm good with python but QT is
> wearing my brain out so please help me understand this.
> Thanks,
> Lawrence
>     @QtCore.pyqtSignature("")
>     def on_editButton_clicked(self):
>         self.win = filterEdit()
>         self.win.show()
> class filterEdit(QtGui.QWidget):
>     def __init__(self):
>         QtGui.QWidget.__init__(self)
>         self.ui = Ui_filterEdit()
>         self.ui.setupUi(self)

It's a top level window because it doesn't have a parent. If you want it to be 
embedded in another widget then you have to add it to that widget's layout 
(preferably in that widget's __init__() and only show() it when you want to 
see it).


More information about the PyQt mailing list