[PyKDE] QCanvasSprite segfaulting

Vio vmilitaru at sympatico.ca
Tue Feb 18 12:14:00 GMT 2003


Greetings,
Newbie hits wall while dipping toe in QCanvas.
Would someone be kind enough to tell
me why I get a segfault while trying to "show()" a sprite?


my entire code:

# START OF CODE --------------------------------------------
#
# Testing QCanvas
#

import sys
from qt import *
from qtcanvas import *
TRUE = 1
FALSE = 0

class MY(QCanvas):

      def __init__(self,h = 1000, w=1000):
		QCanvas.__init__(self,h,w)
		self.view =  QCanvasView(self)

# testing text
		self.item = QCanvasText('Testosterone',QFont (),self)
		self.item.setX(50)
		self.item.setY(50)
		self.item.show()

# testing sprite
		spix = QCanvasPixmapArray()
		spix.setImage(0,QCanvasPixmap("test.png"))
		sprite = QCanvasSprite(spix, self)
		sprite.move(100, 100, 0)
		sprite.show() #<-- gives Segmentation fault
# error message:
#QPixmap::operator=: Cannot assign to pixmap during painting

# Note: if commenting out the "sprite.show()" line, the QCanvasText
# shows up as expected.


# show items on screen
		self.view.show()
		self.update()


if __name__ == "__main__":
	a = QApplication(sys.argv)
	QObject.connect(a,SIGNAL("lastWindowClosed()"),a,SLOT("quit()"))
	w = MY()
	a.exec_loop()

# END OF CODE --------------------------------------------



Kind Regards,
Vio




More information about the PyQt mailing list