我是PyQt4的新手。我的問題很簡單:我無法打開密碼窗口,並且在進行身份驗證時關閉/隱藏它,然後打開一個新的單獨窗口。第二個窗口消失得很快。我的方法一直是這樣(簡化):在PyQt4上顯示連續的窗口
import sys, time
from PyQt4 import QtGui
class Window2(QtGui.QWidget):
def __init__(self):
super(Window2, self).__init__()
self.initUI()
def initUI(self):
self.setWindowTitle('Window2')
# ...add the widgets, etc.
self.show()
class PasswordWindow(QtGui.QWidget):
def __init__(self):
super(PasswordWindow, self).__init__()
self.initUI()
def initUI(self):
self.setWindowTitle('PasswordWindow')
self.show()
# ...Here, I'd input the password, authenticate, etc
self.hide()
w2 = window2() # go to the true main window
def main():
app = QtGui.QApplication(sys.argv)
pw = PasswordWindow()
sys.exit(app.exec_())
if __name__ == '__main__':
main()
在此先感謝!
謝謝,邁克,這工作,這是一個範圍問題。 – 2014-10-31 13:23:21