Make qwidget in new window in PyQt4

Posted by matt on Stack Overflow See other posts from Stack Overflow or by matt
Published on 2010-05-01T22:00:14Z Indexed on 2010/05/01 22:07 UTC
Read the original article Hit count: 156

Filed under:
|
|

I'm trying to make a class that extends qwidget, that pops up a new window, I must be missing something fundamental,

class NewQuery(QtGui.QWidget):
 def __init__(self, parent):
  QtGui.QMainWindow.__init__(self,parent)
  self.setWindowTitle('Add New Query')
  grid = QtGui.QGridLayout()
  label = QtGui.QLabel('blah')
  grid.addWidget(label,0,0)
  self.setLayout(grid)
  self.resize(300,200)

when a new instance of this is made in main window's class, and show() called, the content is overlaid on the main window, how can I make it display in a new window?

© Stack Overflow or respective owner

Related posts about python

Related posts about pyqt4