[PyQt] QGraphicsScene problem
Curtis Faith
curtis at worldhouse.org
Mon Jul 2 09:49:24 BST 2007
I also just tried this and it worked fine on my fresh install of PyQt
running in Eric 4 on Mac OS X 10.4
I get a window with "a" and "b" plus I get:
Python 2.5.1 (r251:54869, Apr 18 2007, 22:08:04)
[GCC 4.0.1 (Apple Computer, Inc. build 5367)] on curtis-faiths-
computer.local, Standard
>>> <class 'PyQt4.QtGui.QGraphicsTextItem'>
a
on Eric's console as expected.
- Curtis
On Jul 2, 2007, at 05:29 , Phil Thompson wrote:
>> import sys
>> from PyQt4 import QtCore, QtGui
>>
>> class CalendarScene(QtGui.QGraphicsScene):
>> def __init__(self, parent = None):
>> QtGui.QGraphicsScene.__init__(self, parent)
>>
>> a = QtGui.QGraphicsTextItem()
>> a.setPlainText('a')
>> a.setPos(0, 0)
>> self.addItem(a)
>>
>> b = QtGui.QGraphicsTextItem()
>> b.setPlainText('b')
>> b.setPos(50, 0)
>> self.addItem(b)
>>
>> # prints <class 'PyQt4.QtGui.QGraphicsTextItem'> as expected
>> print self.items()[0].__class__
>>
>> # segfaults
>> print self.items()[0].toPlainText()
>>
>> if __name__ == "__main__":
>> app = QtGui.QApplication(sys.argv)
>> window = QtGui.QGraphicsView()
>> scene = CalendarScene()
>> window.setScene(scene)
>> window.show()
>> sys.exit(app.exec_())
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20070702/8fdd2c09/attachment.html
More information about the PyQt
mailing list