Advertisement
Guest User

PyQt QSplashScreen Ubuntu problem

a guest
Jul 18th, 2013
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.36 KB | None | 0 0
  1. """
  2. Splash screen example
  3.  
  4. Eli Bendersky (eliben@gmail.com)
  5. License: this code is in the public domain
  6. Last modified: 09.05.2009
  7. """
  8. from PyQt4.QtCore import *
  9. from PyQt4.QtGui import *
  10.  
  11.  
  12. class Form(QDialog):
  13.     """ Just a simple dialog with a couple of widgets
  14.    """
  15.     def __init__(self, parent=None):
  16.         super(Form, self).__init__(parent)
  17.         self.browser = QTextBrowser()
  18.         self.setWindowTitle('Just a dialog')
  19.         self.lineedit = QLineEdit("Write something and press Enter")
  20.         self.lineedit.selectAll()
  21.         layout = QVBoxLayout()
  22.         layout.addWidget(self.browser)
  23.         layout.addWidget(self.lineedit)
  24.         self.setLayout(layout)
  25.         self.lineedit.setFocus()
  26.         self.connect(self.lineedit, SIGNAL("returnPressed()"),
  27.                      self.update_ui)
  28.  
  29.     def update_ui(self):
  30.         self.browser.append(self.lineedit.text())
  31.  
  32.  
  33. if __name__ == "__main__":
  34.     import sys, time
  35.  
  36.     app = QApplication(sys.argv)
  37.  
  38.     # Create and display the splash screen
  39.     splash_pix = QPixmap('splash_loading.png')
  40.     splash = QSplashScreen(splash_pix, Qt.WindowStaysOnTopHint)
  41.     splash.setMask(splash_pix.mask())
  42.     splash.show()
  43.     app.processEvents()
  44.  
  45.     # Simulate something that takes time
  46.     time.sleep(2)
  47.  
  48.     form = Form()
  49.     form.show()
  50.     splash.finish(form)
  51.     app.exec_()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement