Question

I am trying to populate a window QListWidget but when I run the code the empty QDialog Window shows up .

   app = QtGui.QApplication(sys.argv)
   app.setStyle("cleanlooks")

   dialogWin=QtGui.QDialog()
   dialogWin.setWindowTitle("QDialog Window")
   dialogWin.setGeometry(100,230,270,210)
   data=QtCore.QStringList()
   data << "one" << "two" << "three" << "four" << "five"
   layout = QtGui.QHBoxLayout()
   layout.setMargin(1)
   listWidget=QtGui.QListWidget()
   layout.addWidget(listWidget)
   layout.addStretch(1)
   dialogWin.show()

the windows shows up empty!!! why ?

Was it helpful?

Solution

You're not telling layout what widget it belongs to. Try this:

layout = QtGui.QHBoxLayout(dialogWin)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top