![]() |
[PyQt] Cant create a py to exe file - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: GUI (https://python-forum.io/forum-10.html) +--- Thread: [PyQt] Cant create a py to exe file (/thread-7566.html) |
Cant create a py to exe file - ranjithcr2 - Jan-16-2018 Hi all, please help me to convert py program to exe which i created with pyqt4. i have tried pyinstaller, py2exe and all available sources,but nothing works out. if somebody can help me, i could mail my program file ..please ..thanks in advance. RE: Cant create a py to exe file - ranjithcr2 - Jan-16-2018 #this is the program code which i created:# Created by: Ranjith Ravindran, Email:[email protected] # # WARNING! All changes made in this file will be lost! from PyQt4 import QtCore, QtGui import sqlite3 import xlwt from datetime import datetime from datetime import timedelta try: _fromUtf8 = QtCore.QString.fromUtf8 except AttributeError: def _fromUtf8(s): return s try: _encoding = QtGui.QApplication.UnicodeUTF8 def _translate(context, text, disambig): return QtGui.QApplication.translate(context, text, disambig, _encoding) except AttributeError: def _translate(context, text, disambig): return QtGui.QApplication.translate(context, text, disambig) def __init__(self): def createTable(): connection = sqlite3.connect('login.db') connection.execute("CREATE TABLE VIOLATION (DATE,NAME TEXT NOT NULL,STAFF_NUMBER varchar(255),MX_NUMBER TEXT,OB_DATE TEXT,TYP TEXT,OFFENCES TEXT,VIOLATION_ TEXT,CORRECTIVE_ACTION TEXT)") connection.execute("INSERT INTO VIOLATION VALUES(?,?,?,?,?,?,?,?,?)",('date','name','staff_num','mx_num','ob_da','typ','offen','vio','cor')) connection.commit() result = connection.execute("SELECT * FROM VIOLATION") connection.close() createTable() class loginw(object): def login_check(self): username = self.u_lineEdit.text() password = self.u_lineEdit_2.text() if username == 'ah' and password == 'ah': print("login Granted") self.updatewindow = QtGui.QDialog() self.ui = Ui_Dialog3() self.ui.setupUi(self.updatewindow) self.updatewindow.show() Dialog.close() else: print("User Not Found") self.showMessageBox('Warning',"Wrong User Name or Password") def showMessageBox(self, title,message): msgBox = QtGui.QMessageBox() msgBox.setIcon(QtGui.QMessageBox.Warning) msgBox.setWindowTitle(title) msgBox.setText(message) msgBox.setStandardButtons(QtGui.QMessageBox.Ok) msgBox.exec_() def setupUi(self, Dialog): Dialog.setObjectName(_fromUtf8("Dialog")) Dialog.setFixedSize(680,400) Dialog.setStyleSheet(_fromUtf8("QDialog{\n" "Background-color:qlineargradient(spread:reflect, x1:0, y1:0, x2:1, y2:1, stop:0 rgba(0, 169, 255, 147), stop:1 rgba(0, 0, 0, 147));\n" "}\n" "\n" "QLabel#label{\n" "color:rgb(0, 255, 255); \n" " ;\n" " font: 75 italic 28pt \"Times New Roman\";\n" "}\n" "\n" "QLabel{\n" "color:rgb(85, 255, 255);\n" "}")) self.label = QtGui.QLabel(Dialog) self.label.setGeometry(QtCore.QRect(90, 30, 311, 51)) font = QtGui.QFont() font.setFamily(_fromUtf8("Times New Roman")) font.setPointSize(28) font.setBold(False) font.setItalic(True) font.setUnderline(False) font.setWeight(9) self.label.setFont(font) self.label.setObjectName(_fromUtf8("label")) self.u_label = QtGui.QLabel(Dialog) self.u_label.setGeometry(QtCore.QRect(120, 100, 101, 41)) font = QtGui.QFont() font.setFamily(_fromUtf8("Montserrat")) font.setPointSize(10) font.setBold(True) font.setWeight(75) self.u_label.setFont(font) self.u_label.setStyleSheet(_fromUtf8("")) self.u_label.setObjectName(_fromUtf8("u_label")) self.p_label = QtGui.QLabel(Dialog) self.p_label.setGeometry(QtCore.QRect(120, 150, 101, 31)) font = QtGui.QFont() font.setFamily(_fromUtf8("Montserrat")) font.setPointSize(10) font.setBold(True) font.setWeight(75) self.p_label.setFont(font) self.p_label.setObjectName(_fromUtf8("p_label")) self.u_lineEdit = QtGui.QLineEdit(Dialog) self.u_lineEdit.setGeometry(QtCore.QRect(220, 110, 113, 20)) self.u_lineEdit.setObjectName(_fromUtf8("u_lineEdit")) self.u_lineEdit_2 = QtGui.QLineEdit(Dialog) self.u_lineEdit_2.setGeometry(QtCore.QRect(220, 160, 113, 21)) self.u_lineEdit_2.setEchoMode(QtGui.QLineEdit.Password) self.u_lineEdit_2.setObjectName(_fromUtf8("u_lineEdit_2")) self.login_btn = QtGui.QPushButton(Dialog) self.login_btn.setGeometry(QtCore.QRect(310, 200, 75, 31)) ####################################login Button################### self.login_btn.clicked.connect(self.login_check) self.u1_label = QtGui.QLabel(Dialog) self.u1_label.setGeometry(QtCore.QRect(10, 370, 380, 41)) font = QtGui.QFont() font.setFamily(_fromUtf8("Montserrat")) font.setPointSize(7) font.setBold(False) font.setWeight(75) self.u1_label.setFont(font) self.u1_label.setStyleSheet(_fromUtf8("color:rgb(170, 170, 127)")) self.u1_label.setObjectName(_fromUtf8("u1_label")) font = QtGui.QFont() font.setPointSize(10) font.setBold(True) font.setItalic(False) font.setWeight(75) self.login_btn.setFont(font) self.login_btn.setObjectName(_fromUtf8("login_btn")) self.retranslateUi(Dialog) QtCore.QMetaObject.connectSlotsByName(Dialog) def retranslateUi(self, Dialog): Dialog.setWindowTitle(_translate("Dialog", "Violation Database", None)) self.label.setText(_translate("Dialog", "Safety User Login:", None)) self.u_label.setText(_translate("Dialog", "User Name", None)) self.u1_label.setText(_translate("Dialog", "Developed By Ranjith Ravindran", None)) self.p_label.setText(_translate("Dialog", "Password", None)) self.login_btn.setText(_translate("Dialog", "Login", None)) class Ui_Dialog3(object): def __init__(self): super(Ui_Dialog3,self).__init__() self.Obj = QtGui.QDateEdit() self.Obj.setDate(QtCore.QDate.currentDate()) self.Obj.setGeometry(QtCore.QRect(30, 20, 131, 21)) def search(self): print("Search Result") self.searchwindow = QtGui.QMainWindow() self.ui = Ui_MainWindow() self.ui.setupUi(self.searchwindow) self.searchwindow.show() Dialog.close() ################################################### def update(self): self.date = self.dateEdit.date().toString("dd/MM/yyyy") self.date1 = self.dateEdit1.date().toString("dd/MM/yyyy") print(self.date) name = self.lineEdit.text() staff_num = self.lineEdit_2.text() mx_num = self.lineEdit_3.text() typ = self.comboBox.currentText() offen = self.textEdit_COM.toPlainText() vio = self.textEdit.toPlainText() cor = self.textEdit_2.toPlainText() if name == ("") or staff_num == ("") or typ == (""): self.showMessageBox('Can\' Update',"Please Fill Out all Required Field") else: connection = sqlite3.connect("login.db") connection.execute("INSERT INTO VIOLATION VALUES(?,?,?,?,?,?,?,?,?)",(self.date,name,staff_num,mx_num,self.date1,typ,offen,vio,cor)) connection.commit() connection.close() self.lineEdit.clear() self.lineEdit_2.clear() self.lineEdit_3.clear() self.textEdit.clear() self.textEdit_2.clear() self.successMessageBox("Updated","Warninng Letter has been updated Successfully") self.lineEdit_com.clear() self.textEdit_COM.clear() def successMessageBox(self, title,message): msgBox = QtGui.QMessageBox() msgBox.setWindowTitle(title) msgBox.setText(message) msgBox.setStandardButtons(QtGui.QMessageBox.Ok) msgBox.exec_() def showMessageBox(self, title,message): msgBox = QtGui.QMessageBox() msgBox.setIcon(QtGui.QMessageBox.Warning) msgBox.setWindowTitle(title) msgBox.setText(message) msgBox.setStandardButtons(QtGui.QMessageBox.Ok) msgBox.exec_() print("Successfully Updated") def setupUi(self, Dialog): Dialog.setObjectName(_fromUtf8("Dialog")) Dialog.resize(780, 609) Dialog.setStyleSheet(_fromUtf8("QDialog{\n" "Background-color:qlineargradient(spread:pad, x1:0.966045, y1:1, x2:0, y2:0, stop:0 rgba(0, 0, 0, 255), stop:1 rgba(255, 255, 255, 255));\n" "}\n" "QPushButton#pushButton_2{\n" "Background-color:rgb(0, 170, 0);\n" "color:white;\n" "}\n" "QPushButton#pushButton{\n" "Background-color:rgb(170, 170, 127);\n" "color:black;\n" "}")) self.label = QtGui.QLabel(Dialog) self.label.setGeometry(QtCore.QRect(60, 90, 81, 31)) font = QtGui.QFont() font.setFamily(_fromUtf8("Times New Roman")) font.setPointSize(12) font.setBold(True) font.setWeight(75) self.label.setFont(font) self.label.setObjectName(_fromUtf8("label")) self.label_3 = QtGui.QLabel(Dialog) self.label_3.setGeometry(QtCore.QRect(20, 130, 101, 31)) font = QtGui.QFont() font.setFamily(_fromUtf8("Times New Roman")) font.setPointSize(12) font.setBold(True) font.setWeight(75) self.label_3.setFont(font) self.label_3.setObjectName(_fromUtf8("label_3")) self.label_4 = QtGui.QLabel(Dialog) self.label_4.setGeometry(QtCore.QRect(250, 130, 91, 31)) font = QtGui.QFont() font.setFamily(_fromUtf8("Times New Roman")) font.setPointSize(12) font.setBold(True) font.setWeight(75) self.label_4.setFont(font) self.label_4.setObjectName(_fromUtf8("label_4")) self.label_5 = QtGui.QLabel(Dialog) self.label_5.setGeometry(QtCore.QRect(20, 340, 91, 31)) font = QtGui.QFont() font.setFamily(_fromUtf8("Times New Roman")) font.setPointSize(12) font.setBold(True) font.setWeight(75) self.label_5.setFont(font) self.label_5.setObjectName(_fromUtf8("label_5")) self.label_6 = QtGui.QLabel(Dialog) self.label_6.setGeometry(QtCore.QRect(10, 420, 201, 51)) font = QtGui.QFont() font.setFamily(_fromUtf8("Times New Roman")) font.setPointSize(12) font.setBold(True) font.setWeight(75) self.label_6.setFont(font) self.label_6.setObjectName(_fromUtf8("label_6")) self.lineEdit = QtGui.QLineEdit(Dialog) self.lineEdit.setGeometry(QtCore.QRect(120, 100, 113, 20)) self.lineEdit.setContextMenuPolicy(QtCore.Qt.NoContextMenu) self.lineEdit.setObjectName(_fromUtf8("lineEdit")) self.lineEdit_2 = QtGui.QLineEdit(Dialog) self.lineEdit_2.setGeometry(QtCore.QRect(120, 140, 113, 20)) self.lineEdit_2.setObjectName(_fromUtf8("lineEdit_2")) self.lineEdit_3 = QtGui.QLineEdit(Dialog) self.lineEdit_3.setGeometry(QtCore.QRect(350, 140, 113, 20)) self.lineEdit_3.setObjectName(_fromUtf8("lineEdit_3")) self.textEdit = QtGui.QTextEdit(Dialog) self.textEdit.setGeometry(QtCore.QRect(110, 340, 561, 90)) self.textEdit.setObjectName(_fromUtf8("textEdit")) self.textEdit.setStyleSheet(_fromUtf8("Background-color:rgb(170, 255, 127);\n""color:black;""color:blue;""font: 75 10pt \"Times New Roman\";")) self.textEdit_2 = QtGui.QTextEdit(Dialog) self.textEdit_2.setGeometry(QtCore.QRect(110, 460, 561, 60)) self.textEdit_2.setObjectName(_fromUtf8("textEdit_2")) self.textEdit_2.setStyleSheet(_fromUtf8("Background-color:rgb(170, 255, 127);\n""color:black;""color:blue;""font: 75 10pt \"Times New Roman\";")) self.pushButton = QtGui.QPushButton(Dialog) self.pushButton.setGeometry(QtCore.QRect(600, 530, 75, 41)) self.pushButton.clicked.connect(self.update) self.pushButton.setStyleSheet(_fromUtf8("Background-color:rgb(0, 0, 127);\n""color:white;")) font = QtGui.QFont() font.setPointSize(10) font.setBold(True) font.setWeight(75) self.pushButton.setFont(font) self.pushButton.setObjectName(_fromUtf8("pushButton")) self.label_2 = QtGui.QLabel(Dialog) self.label_2.setGeometry(QtCore.QRect(210, 10, 300, 31)) self.label_2.setStyleSheet(_fromUtf8("color:rgb(170, 85, 0);")) font = QtGui.QFont() font.setFamily(_fromUtf8("Times New Roman")) font.setPointSize(24) font.setBold(True) font.setWeight(75) self.label_2.setFont(font) self.label_2.setObjectName(_fromUtf8("label_2")) #self.lineEdit_4 = QtGui.QLineEdit(Dialog) #self.lineEdit_4.setGeometry(QtCore.QRect(30, 20, 131, 21)) #self.lineEdit_4.setContextMenuPolicy(QtCore.Qt.NoContextMenu) #self.lineEdit_4.setObjectName(_fromUtf8("lineEdit_4")) self.pushButton_2 = QtGui.QPushButton(Dialog) self.pushButton_2.setGeometry(QtCore.QRect(670, 10, 75, 31)) self.pushButton_2.clicked.connect(self.search) font = QtGui.QFont() font.setPointSize(10) font.setBold(True) font.setWeight(75) self.pushButton_2.setFont(font) self.pushButton_2.setObjectName(_fromUtf8("pushButton_2")) self.line = QtGui.QFrame(Dialog) self.line.setGeometry(QtCore.QRect(-10, 49, 571, 41)) self.line.setFrameShape(QtGui.QFrame.HLine) self.line.setFrameShadow(QtGui.QFrame.Sunken) self.line.setObjectName(_fromUtf8("line")) self.label_7 = QtGui.QLabel(Dialog) self.label_7.setGeometry(QtCore.QRect(20, 220, 131, 31)) font = QtGui.QFont() font.setFamily(_fromUtf8("Times New Roman")) font.setPointSize(12) font.setBold(True) font.setWeight(75) self.label_7.setFont(font) self.label_7.setObjectName(_fromUtf8("label_7")) self.dateEdit = QtGui.QDateEdit(Dialog) self.dateEdit.setGeometry(QtCore.QRect(30, 20, 110, 22)) self.dateEdit.setDateTime(QtCore.QDateTime(QtCore.QDate(2017, 1, 1), QtCore.QTime(0, 0, 0))) self.dateEdit.setObjectName(_fromUtf8("dateEdit")) self.dateEdit1 = QtGui.QDateEdit(Dialog) self.dateEdit1.setGeometry(QtCore.QRect(120, 180, 110, 22)) self.dateEdit1.setDateTime(QtCore.QDateTime(QtCore.QDate(2017, 1, 1), QtCore.QTime(0, 0, 0))) self.dateEdit1.setObjectName(_fromUtf8("dateEdit1")) self.label_8 = QtGui.QLabel(Dialog) self.label_8.setGeometry(QtCore.QRect(20, 173, 101, 31)) font = QtGui.QFont() font.setFamily(_fromUtf8("Times New Roman")) font.setPointSize(12) font.setBold(True) font.setWeight(75) self.label_8.setFont(font) self.label_8.setObjectName(_fromUtf8("label_8")) self.label_9 = QtGui.QLabel(Dialog) self.label_9 = QtGui.QLabel(Dialog) self.label_9.setGeometry(QtCore.QRect(350, 173,360,51)) font = QtGui.QFont() font.setFamily(_fromUtf8("Times New Roman")) font.setPointSize(13) font.setBold(True) font.setWeight(75) self.label_9.setFont(font) self.label_9.setObjectName(_fromUtf8("label_9")) self.label_9.setStyleSheet(_fromUtf8("color:darkblue;")) self.date1 = self.dateEdit1.date() self.comboButton = QtGui.QPushButton(Dialog) self.comboButton.setGeometry(QtCore.QRect(500,227, 75, 31)) self.comboButton.clicked.connect(self.setType) font = QtGui.QFont() font.setPointSize(10) font.setBold(True) font.setWeight(75) self.comboButton.setFont(font) self.comboButton.setObjectName(_fromUtf8("comboButton")) self.comboButton.setStyleSheet(_fromUtf8("Background-color:rgb(170, 85, 0);\n""color:white;")) self.refButton = QtGui.QPushButton(Dialog) self.refButton.setGeometry(QtCore.QRect(5000,285, 37, 31)) self.refButton.clicked.connect(self.setRef) font = QtGui.QFont() font.setPointSize(10) font.setBold(True) font.setWeight(75) self.refButton.setFont(font) self.refButton.setObjectName(_fromUtf8("refButton")) self.refButton.setStyleSheet(_fromUtf8("Background-color:rgb(170, 85, 0);\n""color:white;")) ##########################################################COBO################################################### self.comboBox = QtGui.QComboBox(Dialog) self.comboBox.setGeometry(QtCore.QRect(150, 230, 321, 27)) self.comboBox.setObjectName(_fromUtf8("comboBox")) self.comboBox.addItem(_fromUtf8("Select Type")) self.comboBox.addItem(_fromUtf8("Accident ")) self.comboBox.addItem(_fromUtf8("Incident")) self.comboBox.addItem(_fromUtf8("Other")) self.lineEdit_com = QtGui.QLineEdit(Dialog) self.lineEdit_com.setGeometry(QtCore.QRect(5000,237, 75, 31)) self.label_COM= QtGui.QLabel(Dialog) font = QtGui.QFont() self.label_COM.setGeometry(QtCore.QRect(5000, 340, 91, 31)) font.setFamily(_fromUtf8("Times New Roman")) font.setPointSize(12) font.setBold(True) font.setWeight(75) self.label_COM.setFont(font) self.label_COM.setObjectName(_fromUtf8("label_COM")) self.textEdit_COM = QtGui.QTextEdit(Dialog) self.textEdit_COM.setGeometry(QtCore.QRect(5000, 340, 91, 31)) self.textEdit_COM.setObjectName(_fromUtf8("textEdit")) self.textEdit_COM.setStyleSheet(_fromUtf8("Background-color:rgb(170, 255, 127);\n""color:blue;""font: 75 10pt \"Times New Roman\";")) self.pushButton_4 = QtGui.QPushButton(Dialog) self.pushButton_4.setGeometry(QtCore.QRect(240, 180, 80, 25)) font = QtGui.QFont() font.setPointSize(10) font.setBold(True) font.setWeight(75) self.pushButton_4.setFont(font) self.pushButton_4.setStyleSheet(_fromUtf8("Background-color:rgb(255, 85, 0);\n""color:black;")) self.pushButton_4.setObjectName(_fromUtf8("pushButton_4")) self.pushButton_4.clicked.connect(self.dateEx) self.pushButton_4.setStyleSheet(_fromUtf8("Background-color:rgb(170, 85, 0);\n""color:white;")) self.retranslateUi(Dialog) QtCore.QMetaObject.connectSlotsByName(Dialog) def dateEx(self): a = (self.dateEdit1.date().addDays(60).toString()) self.date1 = self.dateEdit1.date().toString("dd/MM/yyyy") self.label_9.setText("ADP Should be collected before\n%s" %a) def setType(self): self.text = str(self.comboBox.currentText()) if self.text == 'Other': self.lineEdit_com.setGeometry(QtCore.QRect(110,285, 37, 31)) self.label_COM.setGeometry(QtCore.QRect(20, 285, 91, 31)) self.refButton.setGeometry(QtCore.QRect(150,285, 37, 31)) if self.text != 'Other' : self.lineEdit_com.setGeometry(QtCore.QRect(5000,285, 75, 31)) self.label_COM.setGeometry(QtCore.QRect(5000, 285, 91, 31)) self.textEdit_COM.setGeometry(QtCore.QRect(5000, 285, 476, 40)) self.refButton.setGeometry(QtCore.QRect(5000,285, 37, 31)) def setRef(self): if self.lineEdit_com.text()=='1': self.textEdit_COM.setGeometry(QtCore.QRect(190, 285, 476, 40)) self.textEdit_COM.setText("Driving under the influence of alcohol, illegal drugs or any medication known to effect safe driving ability.[permanent ban][Fine 1000 AED]") elif self.lineEdit_com.text()=='2': self.textEdit_COM.setGeometry(QtCore.QRect(190, 285, 476, 40)) self.textEdit_COM.setText("Operating a vehicle without an Airside Driving Permit. [1 year ban][fine 1000 AED]") elif self.lineEdit_com.text()=='3': self.textEdit_COM.setGeometry(QtCore.QRect(190, 285, 476, 40)) self.textEdit_COM.setText("Operating a vehicle without an Airside Vehicle Permit.. [1 year ban][fine 1000 AED]") elif self.lineEdit_com.text()=='4': self.textEdit_COM.setGeometry(QtCore.QRect(190, 285, 476, 40)) self.textEdit_COM.setText("Dangerous driving on a Taxiway or Runway.") elif self.lineEdit_com.text()=='5': self.textEdit_COM.setGeometry(QtCore.QRect(190, 285, 476, 40)) self.textEdit_COM.setText("Any act deemed an immediate threat to safety on the aerodrome but not defined below.") elif self.lineEdit_com.text()=='6': self.textEdit_COM.setGeometry(QtCore.QRect(190, 285, 476, 40)) self.textEdit_COM.setText("Failing to present an ADP or AVP on request.. [3 Point][fine 200 AED]") elif self.lineEdit_com.text()=='7': self.textEdit_COM.setGeometry(QtCore.QRect(190, 285, 476, 40)) self.textEdit_COM.setText("Driving with an expired ADP (less than 1 month out of date).[3 Point][fine 200 AED]") elif self.lineEdit_com.text()=='8': self.textEdit_COM.setGeometry(QtCore.QRect(190, 285, 476, 40)) self.textEdit_COM.setText("Driving and/or parking on restricted areas (as indicated by red or yellow markings).[3 Point][fine 200 AED]") elif self.lineEdit_com.text()=='9': self.textEdit_COM.setGeometry(QtCore.QRect(190, 285, 476, 40)) self.textEdit_COM.setText("Operating a vehicle without an Airside Driving Permit. [3 Point][fine 200 AED]") elif self.lineEdit_com.text()=='10': self.textEdit_COM.setGeometry(QtCore.QRect(190, 285, 476, 40)) self.textEdit_COM.setText("Failing to observe a red traffic signal.[3 Point][fine 200 AED]") elif self.lineEdit_com.text()=='11': self.textEdit_COM.setGeometry(QtCore.QRect(190, 285, 476, 40)) self.textEdit_COM.setText("Use of a mobile phone while driving (excluding hands-free).[3 Point][fine 200 AED]") elif self.lineEdit_com.text()=='12': self.textEdit_COM.setGeometry(QtCore.QRect(190, 285, 476, 40)) self.textEdit_COM.setText("Driving with vehicle/equipment defect (includes driving without a functioning beacon, fire extinguisher). [3 Point][fine 200 AED]") elif self.lineEdit_com.text()=='13': self.textEdit_COM.setGeometry(QtCore.QRect(190, 285, 476, 40)) self.textEdit_COM.setText("Failing to obey road signage, markings or other instructions. [3 Point][fine 200 AED]") elif self.lineEdit_com.text()=='14': self.textEdit_COM.setGeometry(QtCore.QRect(190, 285, 476, 40)) self.textEdit_COM.setText("Driving with a load that is not adequately secured and/or is a source of FOD. [3 Point][fine 200 AED]") elif self.lineEdit_com.text()=='15': self.textEdit_COM.setGeometry(QtCore.QRect(190, 285, 476, 40)) self.textEdit_COM.setText("Driving the wrong way in a one-way system. [3 Point][fine 200 AED]") elif self.lineEdit_com.text()=='16': self.textEdit_COM.setGeometry(QtCore.QRect(190, 285, 476, 40)) self.textEdit_COM.setText("Unauthorised transit through an Apron. [3 Point][fine 200 AED]") elif self.lineEdit_com.text()=='17': self.textEdit_COM.setGeometry(QtCore.QRect(190, 285, 476, 40)) self.textEdit_COM.setText("Causing damage to vehicle/equipment/infrastructure. [3 Point][fine 200 AED]") elif self.lineEdit_com.text()=='18': self.textEdit_COM.setGeometry(QtCore.QRect(190, 285, 476, 40)) self.textEdit_COM.setText("Driving vehicle/equipment without appropriate endorsement for any special functions. [3 Point][fine 200 AED]") elif self.lineEdit_com.text()=='19': self.textEdit_COM.setGeometry(QtCore.QRect(190, 285, 476, 40)) self.textEdit_COM.setText("Parking blocked a fire hydrant, emergency exit or evacuation route. [3 Point][fine 200 AED]") elif self.lineEdit_com.text()=='20': self.textEdit_COM.setGeometry(QtCore.QRect(190, 285, 476, 40)) self.textEdit_COM.setText("Obstructing a fuel equipment emergency route. [3 Point][fine 200 AED]") elif self.lineEdit_com.text()=='21': self.textEdit_COM.setGeometry(QtCore.QRect(190, 285, 476, 40)) self.textEdit_COM.setText("Infringing an ERA during an aircraft movement. [3 Point][fine 200 AED]") elif self.lineEdit_com.text()=='21': self.textEdit_COM.setGeometry(QtCore.QRect(190, 285, 476, 40)) self.textEdit_COM.setText("Infringing an ERA during an aircraft movement. [3 Point][fine 200 AED]") elif self.lineEdit_com.text()=='21': self.textEdit_COM.setGeometry(QtCore.QRect(190, 285, 476, 40)) self.textEdit_COM.setText("Infringing an ERA during an aircraft movement. [3 Point][fine 200 AED]") elif self.lineEdit_com.text()=='22': self.textEdit_COM.setGeometry(QtCore.QRect(190, 285, 476, 40)) self.textEdit_COM.setText("Unauthorised use of a Taxiway crossing.. [3 Point][fine 200 AED]") elif self.lineEdit_com.text()=='23': self.textEdit_COM.setGeometry(QtCore.QRect(190, 285, 476, 40)) self.textEdit_COM.setText("Towing load in excess of safe limits.. [3 Point][fine 200 AED]") elif self.lineEdit_com.text()=='24': self.textEdit_COM.setGeometry(QtCore.QRect(190, 285, 476, 40)) self.textEdit_COM.setText("Leaving a vehicle unattended without appropriate parking brake (including ‘Park’ gear for automatic vehicles). [3 Point][fine 200 AED]") elif self.lineEdit_com.text()=='25': self.textEdit_COM.setGeometry(QtCore.QRect(190, 285, 476, 40)) self.textEdit_COM.setText("Failure to display emergency contact numbers in a location clearly visible to a driver. [3 Point][fine 200 AED]") elif self.lineEdit_com.text()=='26': self.textEdit_COM.setGeometry(QtCore.QRect(190, 285, 476, 40)) self.textEdit_COM.setText("Failure to wear appropriate PPE for task (minimum hi-vis) airside. [3 Point][fine 200 AED]") elif self.lineEdit_com.text()=='27': self.textEdit_COM.setGeometry(QtCore.QRect(190, 285, 476, 40)) self.textEdit_COM.setText("Failure to exercise appropriate caution while reversing – including not using a marshaller/banksman where required by SOP. [3 Point][fine 200 AED]") elif self.lineEdit_com.text()=='28': self.textEdit_COM.setGeometry(QtCore.QRect(190, 285, 476, 40)) self.textEdit_COM.setText("Producing or causing FOD airside. [3 Point][fine 200 AED]") elif self.lineEdit_com.text()=='29': self.textEdit_COM.setGeometry(QtCore.QRect(190, 285, 476, 40)) self.textEdit_COM.setText("Failing to remain within visual site and/or close proximity of vehicle while engine running. [3 Point][fine 200 AED]") elif self.lineEdit_com.text()=='30': self.textEdit_COM.setGeometry(QtCore.QRect(190, 285, 476, 40)) self.textEdit_COM.setText("Driving on the manoeuvring area without appropriate ADP. [6 Point][fine 600 AED]") elif self.lineEdit_com.text()=='31': self.textEdit_COM.setGeometry(QtCore.QRect(190, 285, 476, 40)) self.textEdit_COM.setText("Driving with an expired ADP (more than 1 month out of date). [6 Point][fine 500 AED]") elif self.lineEdit_com.text()=='32': self.textEdit_COM.setGeometry(QtCore.QRect(190, 285, 476, 40)) self.textEdit_COM.setText("Endangering the movement of an aircraft (either under power or under tow) including to/from an Apron. [6 Point][fine 500 AED]") elif self.lineEdit_com.text()=='33': self.textEdit_COM.setGeometry(QtCore.QRect(190, 285, 476, 40)) self.textEdit_COM.setText("Not reporting an accident. [6 Point][fine 500 AED]") elif self.lineEdit_com.text()=='34': self.textEdit_COM.setGeometry(QtCore.QRect(190, 285, 476, 40)) self.textEdit_COM.setText("Leaving the scene of an accident. [6 Point][fine 500 AED]") elif self.lineEdit_com.text()=='35': self.textEdit_COM.setGeometry(QtCore.QRect(190, 285, 476, 40)) self.textEdit_COM.setText("Exceeding the speed limit by more than 20 km/h. [6 Point][fine 500 AED]") elif self.lineEdit_com.text()=='36': self.textEdit_COM.setGeometry(QtCore.QRect(190, 285, 476, 40)) self.textEdit_COM.setText("Causing damage to an aircraft. [6 Point][fine 500 AED]") elif self.lineEdit_com.text()=='37': self.textEdit_COM.setGeometry(QtCore.QRect(190, 285, 476, 40)) self.textEdit_COM.setText("Smoking airside – except in designated areas. [6 Point][fine 500 AED]") def retranslateUi(self, Dialog): Dialog.setWindowTitle(_translate("Dialog", "Update ", None)) self.label.setText(_translate("Dialog", "Name", None)) self.label_3.setText(_translate("Dialog", "Staff Number", None)) self.label_4.setText(_translate("Dialog", "MX Number", None)) self.label_5.setText(_translate("Dialog", "Details", None)) self.label_6.setText(_translate("Dialog", "Corrective/ Preventive Action", None)) self.pushButton.setText(_translate("Dialog", "UPDATE", None)) self.label_2.setText(_translate("Dialog", "VIOLATION FORM", None)) self.pushButton_2.setText(_translate("Dialog", "Search", None)) self.label_7.setText(_translate("Dialog", "Type of Violation", None)) self.label_8.setText(_translate("Dialog", "Obtained Date", None)) self.pushButton_4.setText(_translate("Dialog", "Set Date", None)) self.comboButton.setText(_translate("Dialog", "Set Type", None)) self.label_COM.setText(_translate("Dialog", "Ref.No:", None)) self.refButton.setText(_translate("Dialog", "SET", None)) class Ui_MainWindow(object): def search(self): print("Search Result") connection = sqlite3.connect("login.db") search_nu = (self.lineEdit.text()) #query = ("SELECT * FROM VIOLATION WHERE STAFF_NUMBER=?",(search_nu,)) result = connection.execute("SELECT * FROM VIOLATION WHERE STAFF_NUMBER=?",(search_nu,)) self.tableWidget.setRowCount(0) for row_nu, row_data in enumerate(result): self.tableWidget.insertRow(row_nu) for col_nu, data in enumerate(row_data): self.tableWidget.setItem(row_nu,col_nu,QtGui.QTableWidgetItem(str(data))) connection.close() def setupUi(self, MainWindow): MainWindow.setObjectName(_fromUtf8("MainWindow")) MainWindow.resize(780, 600) MainWindow.setStyleSheet(_fromUtf8("QWidget{\n" "Background-color:qlineargradient(spread:reflect, x1:0, y1:0, x2:1, y2:1, stop:0 rgba(0, 169, 255, 147), stop:1 rgba(0, 0, 0, 147));\n" "}\n" "\n" "QTableWidget{\n" "\n" "Background-color:rgb(170, 255, 127);\n" "}\n" "QStatusBar{\n" "color:rgb(0, 255, 0);\n" "}\n" "QPushButton{\n" "Background-color:rgb(85, 170, 127);\n" "}\n" "\n" "QLineEdit{\n" "Background-color:rgb(255, 255, 255);\n" "}")) self.centralwidget = QtGui.QWidget(MainWindow) self.centralwidget.setObjectName(_fromUtf8("centralwidget")) self.tableWidget = QtGui.QTableWidget(self.centralwidget) self.tableWidget.setGeometry(QtCore.QRect(20, 90, 740, 481)) font = QtGui.QFont() font.setBold(True) font.setWeight(75) self.tableWidget.setFont(font) self.tableWidget.setRowCount(15) self.tableWidget.setColumnCount(9) self.tableWidget.setObjectName(_fromUtf8("tableWidget")) self.pushButton = QtGui.QPushButton(self.centralwidget) self.pushButton.setGeometry(QtCore.QRect(580, 20, 75, 41)) self.pushButton.setObjectName(_fromUtf8("pushButton")) self.pushButton.clicked.connect(self.search) self.lineEdit = QtGui.QLineEdit(self.centralwidget) self.lineEdit.setGeometry(QtCore.QRect(460, 30, 113, 21)) self.lineEdit.setObjectName(_fromUtf8("lineEdit")) MainWindow.setCentralWidget(self.centralwidget) self.statusbar = QtGui.QStatusBar(MainWindow) self.statusbar.setObjectName(_fromUtf8("statusbar")) MainWindow.setStatusBar(self.statusbar) self.btn = QtGui.QPushButton("Export",self.centralwidget) self.btn.setGeometry(QtCore.QRect(80, 20, 85, 41)) self.btn.clicked.connect(self.exportExcel) self.retranslateUi(MainWindow) QtCore.QMetaObject.connectSlotsByName(MainWindow) def exportExcel(self): connection = sqlite3.connect("login.db") search_nu = (self.lineEdit.text()) result = connection.execute("SELECT * FROM VIOLATION WHERE STAFF_NUMBER=?",(search_nu,)) n=int((self.tableWidget.rowCount())) list1=(list(result)) workbook=xlwt.Workbook(encoding="utf-8") sheet1=workbook.add_sheet("Violation_Data.xls") style = xlwt.easyxf('pattern: pattern solid, fore_colour light_blue;''font: color white, bold True;''borders: left thin, right thin, top thin, bottom thin;' 'align: horiz right') style2 = xlwt.easyxf('pattern: pattern solid, fore_colour gray25;''borders: left thin, right thin, top thin, bottom thin;''font: color black; align: horiz right') self.tableWidget.setRowCount(0) Title = ['UPDATED DATE' , 'DRIVER NAME' , 'STAFF#' , 'MX#' , 'VIOLATED DATE' , 'TYPE' , 'OFFENCES' ,'DETAILS','CORRECTIVE_ACTION'] for col in range(9): ti = Title[col] sheet1.write(0,col,'%s'%ti,style) workbook.save("Violation_Data.xls") for i in range(n): for j in range(9): a=(list1[i][j]) sheet1.write(i+1,j,'%s' %a,style2) workbook.save("Violation_Data.xls") def retranslateUi(self, MainWindow): MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow", None)) self.pushButton.setText(_translate("MainWindow", "Search", None)) if __name__.endswith('__main__'): import sys app = QtGui.QApplication(sys.argv) Dialog = QtGui.QDialog() ui = loginw() ui.setupUi(Dialog) Dialog.show() sys.exit(app.exec_()) Please help me to create a exe file from the above program or somebody please make a exe file for me as i failed to make it after so many tries.i successfully created a executable file for linux, but in windows its not working. RE: Cant create a py to exe file - metulburr - Jan-16-2018 What do you mean by "Its not working". Give what errors you get, or trouble you had in detail. RE: Cant create a py to exe file - ranjithcr2 - Jan-17-2018 @metulburr , I have created a program as you can see on the attached code. But when i tried to convert it to exe , its just showing a cmd black window for a while and suspending it automatically. I think may i i have missed so many required packages . can you convert the above program to exe , bcox its very urgent as i have to submit it within 2 days.the code it self working perfectly. the error is : The application failed to start because it could not find or load the Qt platform plugin windows |