[prev in list] [next in list] [prev in thread] [next in thread]
List: pykde
Subject: [PyQt] Pb understanding painter
From: "Jean-Baptiste BUTET" <ashashiwa () gmail ! com>
Date: 2007-12-22 8:58:48
Message-ID: 233976e40712220058r3909299fm8a17aa41e916b76d () mail ! gmail ! com
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
Hi all :)
I am trying to draw a cross in a label with coordinates.
I've think (surely false ;) ) make a a widget, place it on coodinates and
paint it with my cross Image.
here is this code :
class point(QtGui.QWidget):
def __init__(self, x, y, parent):
print "parti"
QtGui.QWidget.__init__(self, parent)
self.x = x
self.y = y
def paintEvent(self, event):
print "parti_"
painter = QtGui.QPainter(self)
print "painter_ok"
painter.setPen(QtCore.Qt.black)
painter.drawImage(QtCore.QPoint(self.x,self.y), QtGui.QImage("
croix.png"))
I call my widget with : point_draw = point(x,y,
self.ui.label_where_to_draw_my_widget)
When I do this, I could see my paintEvent is launched (print "parti_") but
nothings happens on my label.
Why ?
Thanks.
JB
--
http://astrolix.org
association des linuxiens astronomes
[Attachment #5 (text/html)]
Hi all :)<br><br>I am trying to draw a cross in a label with \
coordinates.<br><br>I've think (surely false ;) ) make a a widget, place it on \
coodinates and paint it with my cross Image.<br><br>here is this code : <br>class \
point( QtGui.QWidget):<br> <br> def \
__init__(self, x, y, parent):<br> print \
"parti"<br> \
QtGui.QWidget.__init__(self, parent)<br> \
self.x = x<br> self.y = \
y<br> def paintEvent(self, event): \
<br> print \
"parti_"<br> \
<br> painter = \
QtGui.QPainter(self)<br> print \
"painter_ok"<br> \
painter.setPen(QtCore.Qt.black)<br> \
painter.drawImage(QtCore.QPoint(self.x ,self.y), \
QtGui.QImage("croix.png"))<br clear="all"><br><br>I call my widget with : \
point_draw = point(x,y,self.ui.label_where_to_draw_my_widget)<br><br>When I do this, \
I could see my paintEvent is launched (print "parti_") but nothings happens \
on my label. <br><br>Why ?<br><br>Thanks.<br><br>JB<br><br>-- <br><a \
href="http://astrolix.org">http://astrolix.org</a><br>association des linuxiens \
astronomes
_______________________________________________
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