[PyQt] X Errors
Jesse Aldridge
jessealdridge at gmail.com
Sun Mar 29 08:14:13 BST 2009
If I run the following program, and scroll all the way down to the bottom of
the window, I get a bunch of XErrors, like so:
X Error: BadAlloc (insufficient resources for operation) 11
Major opcode: 53 (X_CreatePixmap)
Resource id: 0x8a
X Error: BadDrawable (invalid Pixmap or Window parameter) 9
Extension: 152 (RENDER)
Minor opcode: 4 (RenderCreatePicture)
Resource id: 0x460042e
X Error: RenderBadPicture (invalid Picture parameter) 169
Extension: 152 (RENDER)
Minor opcode: 7 (RenderFreePicture)
Resource id: 0x460042f
I'm not sure if this is a qt bug, a pyqt bug, or what. Any suggestions
would be appreciated.
-----------
import sys
from PyQt4.QtGui import *
from PyQt4.QtCore import *
app = QApplication(sys.argv)
main_window = QMainWindow()
# Create a column of many QTextEdits in a QScrollArea
scroll_area = QScrollArea()
column = QGroupBox()
column.setLayout(QVBoxLayout())
text_edits = []
for i in range(40):
# Add a lot of text to each QTextEdit
text_edit = QTextEdit("Testing " * 1000)
column.layout().addWidget(text_edit)
text_edits.append(text_edit)
main_window.setCentralWidget(scroll_area)
scroll_area.setWidget(column)
scroll_area.setWidgetResizable(True)
main_window.resize(600,300)
# Resize each QTextEdit so that it displays all of its text without
# needing scrollbars
for text_edit in text_edits:
fm = QFontMetrics(text_edit.font())
bounding_rect = QRect(0,0, text_edit.width(), 0)
bounding_rect = fm.boundingRect(bounding_rect, Qt.TextWrapAnywhere,
text_edit.toPlainText())
text_edit.setFixedHeight(bounding_rect.height())
main_window.show()
app.exec_()
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20090329/39644c25/attachment.html
More information about the PyQt
mailing list