[PyQt] QGraphicsScene problem
Andrew Magee
amagee at gmail.com
Tue Jul 3 09:53:42 BST 2007
Thanks for that guys. Turns out that ubuntu 7.04 only has pyqt 4.1
instead of 4.2. I installed the source package of 4.2 and the problem
has gone.
On 7/2/07, Curtis Faith <curtis at worldhouse.org> wrote:
> 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_())
>
> _______________________________________________
> PyQt mailing list PyQt at riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
>
More information about the PyQt
mailing list