I want to update a pixmap on single click, so I tried this:<br><pre>import sys<br>from PyQt4 import QtGui,QtCore<br><br>class myLabel(QtGui.QLabel):<br> def __init__(self,*args,**kwargs):<br> QtGui.QLabel.__init__(self,*args,**kwargs)<br>
<br> self.painter = QtGui.QPainter() <br> <br> def mousePressEvent(self, ev):<br> QtGui.QLabel.mousePressEvent(self,ev)<br> pm = self.pixmap()<br> self.painter.begin(pm)<br> self.painter.setPen(QtGui.QPen(QtCore.Qt.red, 120))<br>
<br> self.painter.drawPoint(ev.pos())<br> self.painter.end()<br> self.setPixmap(pm)<br> print ev.pos()<br> <br><br>if __name__=='__main__':<br> app = QtGui.QApplication(sys.argv)<br>
<br> mw = QtGui.QWidget()<br> model_pm = QtGui.QPixmap(300,300)<br> model_l = myLabel()<br> model_res_pm = QtGui.QPixmap(300,300)<br> model_res_l = myLabel()<br> draw_pm = QtGui.QPixmap(300,300)<br> draw_l = myLabel()<br>
<br> draw_res_pm = QtGui.QPixmap(300,300)<br> draw_res_l = myLabel()<br> map(lambda pm: pm.fill(),(model_pm,model_res_pm,draw_pm,draw_res_pm))<br> <br> model_l.setPixmap(model_pm)<br> model_res_l.setPixmap(model_res_pm)<br>
<br> draw_l.setPixmap(draw_pm)<br> draw_res_l.setPixmap(draw_res_pm)<br> layout = QtGui.QGridLayout()<br> layout.addWidget(model_l,0,0,1,1)<br> layout.addWidget(model_res_l,1,0,1,1)<br> layout.addWidget(draw_l,0,1,1,1)<br>
<br> layout.addWidget(draw_res_l,1,1,1,1)<br> mw.setLayout(layout)<br> mw.show()<br> mw.setFixedSize(mw.geometry().size())<br> sys.exit(app.exec_())</pre>
                <br>On Linux a big red square shows on click (wich is good). But under
Windows pixmaps remain white (checked under Win7 and XP). Looks like a bug to me...<br><br>Code
on pastebin: <a href="http://pastebin.com/BKtNQ8rb" target="_blank">http://pastebin.com/BKtNQ8rb</a><br>
<br>PyQt-4.7 and Python 2.6.4 on both Linux and Windows.