PythonGUIアプリで新しいウィンドウを開くのに問題があります。3つのクラスがあります(最初のログインが表示され、2つ以上のウィンドウが開きます)。これは正常に機能します。
class LoginDialog(QtGui.QDialog):
def __init__(self, parent = None):
super(LoginDialog, self).__init__(parent)
.....
class MainWindow(QtGui.QMainWindow):
def __init__(self, parent = None):
QtGui.QWidget.__init__(self, parent)
.....
class ImageViewerMainWindow(QtGui.QMainWindow):
def __init__(self, path, parent = None):
super(ImageViewerMainWindow, self).__init__(parent)
.....
if __name__ == "__main__":
qtApp = QtGui.QApplication(sys.argv)
loginDlg = LoginDialog()
if not loginDlg.exec_():
sys.exit(-1)
MyMainWindow = MainWindow()
MyMainWindow.show()
viewer = ImageViewerMainWindow("C:\image.jpg")
viewer.show()
sys.exit(qtApp.exec_())
メインウィンドウからビューアを実行する必要がありますが、このように配置すると、点滅して消えます。
class MainWindow(QtGui.QMainWindow):
def __init__(self, parent = None):
QtGui.QWidget.__init__(self, parent)
.....
def DoOpenImageViewer(self):
viewer = ImageViewerMainWindow("C:\image.jpg")
viewer.show()