Search code examples
pythonqtpyqt4qwidget

python.exe crashes (used all system allowance of handles for Window Manager objects)


I am populating cells in two columns of QTableWidget with QTextEdit widgets. When number of rows is over ~1250 python.exe crashes:

pythhon.exe has stopped working

with this message in console, repeating over and over for every next widget in row over 1250:

QWidget::create: Failed to create window (The current process has used all of its system allowance of handles for Window Manager objects.)

so my question is how to increase limit of system handles for win7 (I've found tutorial for xp here , but my SharedSection is already set to 1024,20480,768 and I've read that it is not safe to increase desktop heap over 20480) or maybe populate table the other way? This is how I do that:

textEdit = QtGui.QTextEdit()
textEdit.setPlainText("some text in 1-100 lines")
textEdit.setReadOnly(1)
textEdit.setFrameStyle(QtGui.QFrame.NoFrame)
textEdit.setFixedHeight(400)
textEdit.setFixedWidth(2000)
tableWidget.setCellWidget(i,j,textEdit)

I have Python 2.6 and PyQt 4.7


Solution

  • Since there was no other solution I had to populate table the other way...

    tableWidget.setItem(i, j, QtGui.QTableWidgetItem("text"))
    

    I've kept QtGui.QTextEdit() only in case my "text" has more than 100 lines because scrolling the table in that case is to slow when I use setItem