我有三个Python(3.4.3)脚本.其中一个用于控制PyQt5生成的.ui文件.当我运行GUI程序时,它接受所有数据和所有内容,当我按下InputDialog上的OK按钮时,窗口关闭,控制台显示.
Process finished with exit code 1
当我在Python IDLE上运行相同的代码时,它显示:
<<<<<<RESTART>>>>>>
当我在Visual Studio上使用相同的Python(3.4.3或2.7)代码时,这种情况从未发生过.可能是什么原因?
这是控制.ui文件的python文件的代码.
import sys
from PyQt5 import QtCore, QtGui, uic, QtWidgets
from Email import encrypt_email
from Email import decrypt_email
from Email import newuser
qtCreatorFile = "rsegui.ui" # Enter file here.
Ui_MainWindow, QtBaseClass = uic.loadUiType(qtCreatorFile)
class MyApp(QtWidgets.QMainWindow, Ui_MainWindow):
def __init__(self):
QtWidgets.QMainWindow.__init__(self)
Ui_MainWindow.__init__(self)
self.setupUi(self)
user, ok = QtWidgets.QInputDialog.getText(self, 'New User',
'Are you a new user?')
user=str(user)
if user in "YESYesyesYy":
email, ok = QtWidgets.QInputDialog.getText(self, 'New User',
'Enter Your Email ID:')
email1=str(email) …Run Code Online (Sandbox Code Playgroud)