All pastes #1556618 Raw Edit

pyqt splash screen

public python v1 · immutable
#1556618 ·published 2009-09-07 00:30 UTC
rendered paste body
# display a splash screen with PyQTfrom PyQt4.QtTest import QTest as qtfrom PyQt4.QtCore import *from PyQt4.QtGui import * class Splash(QSplashScreen):     staticMessage_ = ""     def __init__(self):         QSplashScreen.__init__(self)     def setStaticMessage(self, message):         self.staticMessage_ = message         self.update()     def paintEvent(self, event):         QSplashScreen.paintEvent(self, event)         painter = QPainter(self)         pen = QPen(Qt.red)         painter.setPen(pen)        # in case this message is not part of the image         painter.drawText(20, 20, self.staticMessage_) app = QApplication([]) mainWin = QLabel("   Simple Main Window   ") splash = Splash()splash_image = "CloudSplash.jpg" splash.setPixmap(QPixmap(splash_image)) splash.setStaticMessage("Version 2.01") splash.show() # optional message display on splash image# in case this message is not part of the image align = Qt.AlignBottom|Qt.AlignRightsplash.showMessage("wait 6 seconds", align, Qt.yellow) app.processEvents() qt.qSleep(3000) splash.showMessage("wait 3 seconds", align, Qt.green) app.processEvents() qt.qSleep(3000) splash.finish(mainWin) mainWin.show() # does not use sys.exit(app.exec_()), works wellapp.exec_()