Sorry for the indentation of the code but the problem is not there.
My problem is that nothing is printed when the focus of the frame changes.
Christophe.
Hello,
I would like to catch the events when my frame has the focus or losts
it. I don't understand why the following code doesn't work. Indeed, I
would like the frame to have a 0.5 opacity when the focus is out and
1.0 when it is in the frame.
Every tip or clue is welcome.
Christophe.
==========
THE CODE
==========
class MyFrame(QtGui.QFrame):
def __init__(self, parent, titre, pixmapfile):
QtGui.QFrame.__init__(self, parent, QtCore.Qt.Tool)
self.setWindowTitle(titre)
rect = QtCore.QRect(QtGui.QCursor.pos(), pixmapfile.size())
self.setGeometry(rect)
self.setFixedSize(pixmapfile.size())
label = QtGui.QLabel(self)
label.setPixmap(pixmapfile)
label.show()
self.timer = QtCore.QTimer()
self.connect( self.timer, QtCore.SIGNAL("timeout()"),
self, QtCore.SLOT("hide()"))
def focusOutEvent(self, evt):
print 'out'
def focusInEvent(self, evt):
print 'in'
def showEvent(self, evt):
self.timer.start(10000) # 10 seconds
QtGui.QFrame.showEvent(self, evt)
_______________________________________________
PyQt mailing list PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt
_______________________________________________
PyQt mailing list PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt