[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    [PyQt] X Errors
From:       Jesse Aldridge <jessealdridge () gmail ! com>
Date:       2009-03-29 7:14:13
Message-ID: a89f888d0903290014v13e9b3e1l1d1c817d68f44736 () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


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_()

[Attachment #5 (text/html)]

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:<br><br>X Error: BadAlloc (insufficient \
resources for operation) 11<br>  Major opcode: 53 (X_CreatePixmap)<br>  Resource id:  \
0x8a<br>X Error: BadDrawable (invalid Pixmap or Window parameter) 9<br>  Extension:   \
152 (RENDER)<br>  Minor opcode: 4 (RenderCreatePicture)<br>  Resource id:  \
0x460042e<br>X Error: RenderBadPicture (invalid Picture parameter) 169<br>  \
Extension:    152 (RENDER)<br>  Minor opcode: 7 (RenderFreePicture)<br>  Resource id: \
0x460042f<br><br>I&#39;m not sure if this is a qt bug, a pyqt bug, or what.  Any \
suggestions would be appreciated.<br><br>-----------<br> <br><br>import \
sys<br><br>from PyQt4.QtGui import *<br>from PyQt4.QtCore import *<br><br>app = \
QApplication(sys.argv)<br>main_window = QMainWindow()<br><br># Create a column of \
many QTextEdits in a QScrollArea<br>scroll_area = QScrollArea()<br> column = \
QGroupBox()<br>column.setLayout(QVBoxLayout())<br>text_edits = []<br>for i in \
range(40):<br>    # Add a lot of text to each QTextEdit<br>    text_edit = \
QTextEdit(&quot;Testing &quot; * 1000)<br>    \
column.layout().addWidget(text_edit)<br>  text_edits.append(text_edit)    <br>    \
<br>main_window.setCentralWidget(scroll_area)<br><br>scroll_area.setWidget(column)<br>scroll_area.setWidgetResizable(True)<br><br>main_window.resize(600,300)<br><br># \
Resize each QTextEdit so that it displays all of its text without <br> # needing \
scrollbars<br>for text_edit in text_edits:    <br>    fm = \
QFontMetrics(text_edit.font())<br>    bounding_rect = QRect(0,0, text_edit.width(), \
                0)<br>    bounding_rect = fm.boundingRect(bounding_rect, \
                Qt.TextWrapAnywhere, <br>
                                    text_edit.toPlainText())<br>    \
text_edit.setFixedHeight(bounding_rect.height())<br><br>main_window.show()<br>app.exec_()




_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic