[PyQt] QPainter

lucaberto at libero.it lucaberto at libero.it
Thu Dec 13 09:01:37 GMT 2007


Hello i post the same question of two weeks ago but i never get a reply, probably because is a stupid question but pls help me.

i do this code :
 def cornice(self):
        import math
        nome_cal = self.lineEdit.text()
        if nome_cal =='':
            while 2 :
                dlg_line = QtGui.QMessageBox.warning(self,'Pls Attention',  'You must insert a name for the calibration', QtGui.QMessageBox.Cancel)
                break
        else :
            self.frame1.setAttribute(QtCore.Qt.WA_PaintOutsidePaintEvent)
            grone = QtGui.QPainter(self.frame1)
            pen = QtGui.QPen()
            pen.setWidth(1)
            #disegno contorno grafico
            grone.setPen(pen)
            grone.drawText(30, 35, '50 daN/mm')
            grone.drawText(395, 30, nome_cal)
            grone.drawText(30, 430, '0')
            grone.drawText(30, 240, '25')
            grone.drawText(816,430, '0')
            grone.drawText(816, 240, '90')
            grone.drawText(806, 35, 'Deg 180')
            grone.drawText(395, 480, 'Frequency Hz')
            grone.drawText(55, 445, '0')
            grone.drawText(796, 445, '120')
            grone.drawLine(60,40,60,430)
            grone.drawLine(60, 40, 801, 40)
            grone.drawLine(801, 40, 801, 430)
            grone.drawLine(60, 430, 801, 430)
            ## some other line##
            grone.end()
            app.processEvents()

as you can see i draw in a frame located in a tab2, my question is why  when i switch to tab1 and then back to tab2 the frame is clear?
And why if i minimize the widget the farme is clear again?
How i can solve this problem.

Thanks Luca
   




More information about the PyQt mailing list