Re: [PyQt] QGraphicsView to display a png

2007-07-23 Thread kib2
David Boddie a écrit : Ah, it seems that you were setting up the scene from with a method of a class. Your problem was that, when the method returned, the scene was garbage collected. Giving it a parent of "self" keeps it alive thanks to Qt's parent-child object management. Alternatively, you c

Re: [PyQt] QGraphicsView to display a png

2007-07-23 Thread Dave Fancella
On Monday 23 July 2007 5:55 pm, kib2 wrote: > Now, Dave just told me it was a bad idea to put an image on a > QGraphicsView. I've already done it inside a Label, but I've no controls > on it. He suggested I've to write my own widget (from Qlabel or QWidget) > for that, but I don't see why it's a ba

Re: [PyQt] QGraphicsView to display a png

2007-07-23 Thread David Boddie
On Mon Jul 23 23:55:57 BST 2007, kib2 wrote: > Thanks for your hints, > > in fact the problem has been solved yesterday... > My scene was refering to nothing at all, add a "self" like this : > > scene = QtGui.QGraphicsScene(self) > > and the image appears. Ah, it seems that you were setting up

Re: [PyQt] QGraphicsView to display a png

2007-07-23 Thread kib2
David Boddie a écrit : That might fix the problem. Another question worth asking is: have the resources been set up correctly? The assignment, pic = QtGui.QPixmap(":/images/triangle.png") refers to an image in a resource that is usually stored in a module and imported somewhere in an applic

Re: [PyQt] QGraphicsView to display a png

2007-07-23 Thread David Boddie
On Mon Jul 23 23:06:34 BST 2007, Adam Tenderholt wrote: > I think you are drawing your pixmap off the edge of the scene. Try the > following: > > scene = QtGui.QGraphicsScene() > > #scene.setSceneRect(-600,-600, 600,600) > scene.setSceneRect(-600, -600, 1200, 1200) > > pic = QtGui.QPixmap(":/im

Re: [PyQt] QGraphicsView to display a png

2007-07-23 Thread Adam Tenderholt
I think you are drawing your pixmap off the edge of the scene. Try the following: scene = QtGui.QGraphicsScene() #scene.setSceneRect(-600,-600, 600,600) scene.setSceneRect(-600, -600, 1200, 1200) pic = QtGui.QPixmap(":/images/triangle.png") scene.addItem(QtGui.QGraphicsPixmapItem(pic)) view = s

[PyQt] QGraphicsView to display a png

2007-07-21 Thread kib2
Hi, This is the first time I'm playing with QGraphicsView. My aim was simply to display a png image inside it (I need something more convenient than a QLabel). Here's some part of my code (self.gv is just a QGraphicsView instance and a directory "images" has been created inside my script dir