0
我想修改我的代碼以在登錄對話框顯示前添加啓動屏幕(大約2秒) .i嘗試了一些東西(更改爲註釋),但不工作。請向我展示如何修改我的代碼。pyqt中的初始屏幕
import sys
from time import *
from PyQt4 import QtGui,QtCore
from loginD import *
from mainwindow import Ui_MainWindow
class Login(QtGui.QDialog):
#A dialog with username and password lineedit
def __init__(self,parent=None):
QtGui.QDialog.__init__(self,parent)
self.ui=Ui_LoginD()
self.ui.setupUi(self)
self.ui.PasswordLE.setEchoMode(QtGui.QLineEdit.Password)
QtCore.QObject.connect(self.ui.LoginPB,QtCore.SIGNAL('clicked()'),
self.HandleLogin)
def HandleLogin(self):
if self.ui.PasswordLE.text()=="pass":
self.accept()
else:
QtGui.QMessageBox.warning(
self,'Error;','bad')
class Main_Window(QtGui.QMainWindow,):
#main window ui
def __init__(self,parent=None):
QtGui.QWidget.__init__(self,parent)
self.ui=Ui_MainWindow()
self.ui.setupUi(self)
if __name__=='__main__':
app=QtGui.QApplication(sys.argv)
#splash_pix=QtGui.QPixmap('logo and typeface blue.jpg')
#splash=QtGui.QSplashScreen(splash_pix,QtCore.Qt.WindowStaysOnTopHint)
#splash.show()
# app.processEvents()
#time.sleep(2)
if Login().exec_()==QtGui.QDialog.Accepted:
window=Main_Window()
window.show()
sys.exit(app.exec_())
你怎麼樣把閃屏從那裏:http://stackoverflow.com/questions/22423781/using-a-gif- in-splash-screen-in-pyqt – User 2014-11-14 17:05:52
上面的評論 - QSplashScreen http://pyqt.sourceforge.net/Docs/PyQt4/qsplashscreen.html – kwarunek 2014-11-14 23:17:36