├── Student Record Maintainer In Pyqt5 ├── icon │ ├── add1.jpg │ ├── d1.png │ ├── g2.png │ ├── i1.png │ ├── r3.png │ ├── s1.png │ └── dexter.jpg └── SRM In Pyqt5.py └── README.md /Student Record Maintainer In Pyqt5/icon/add1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abhishek305/Student-Record-Maintainer-In-PyQT5/HEAD/Student Record Maintainer In Pyqt5/icon/add1.jpg -------------------------------------------------------------------------------- /Student Record Maintainer In Pyqt5/icon/d1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abhishek305/Student-Record-Maintainer-In-PyQT5/HEAD/Student Record Maintainer In Pyqt5/icon/d1.png -------------------------------------------------------------------------------- /Student Record Maintainer In Pyqt5/icon/g2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abhishek305/Student-Record-Maintainer-In-PyQT5/HEAD/Student Record Maintainer In Pyqt5/icon/g2.png -------------------------------------------------------------------------------- /Student Record Maintainer In Pyqt5/icon/i1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abhishek305/Student-Record-Maintainer-In-PyQT5/HEAD/Student Record Maintainer In Pyqt5/icon/i1.png -------------------------------------------------------------------------------- /Student Record Maintainer In Pyqt5/icon/r3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abhishek305/Student-Record-Maintainer-In-PyQT5/HEAD/Student Record Maintainer In Pyqt5/icon/r3.png -------------------------------------------------------------------------------- /Student Record Maintainer In Pyqt5/icon/s1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abhishek305/Student-Record-Maintainer-In-PyQT5/HEAD/Student Record Maintainer In Pyqt5/icon/s1.png -------------------------------------------------------------------------------- /Student Record Maintainer In Pyqt5/icon/dexter.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/abhishek305/Student-Record-Maintainer-In-PyQT5/HEAD/Student Record Maintainer In Pyqt5/icon/dexter.jpg -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Student-Record-Maintainer-In-PyQT5 2 | 3 | Requriements: 4 | 1.Python 3.7.1 5 | 6 | 2.Pyqt5 Or Pyqt4 will do. 7 | 8 | 3.Pyqt Designer 9 | 10 | Screenshot 11 | 12 | ![demo](https://user-images.githubusercontent.com/29656920/54862708-9e55c400-4d64-11e9-92f3-8529081a1690.png) 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /Student Record Maintainer In Pyqt5/SRM In Pyqt5.py: -------------------------------------------------------------------------------- 1 | from PyQt5.QtCore import * 2 | from PyQt5.QtWidgets import * 3 | from PyQt5.QtGui import * 4 | from PyQt5.QtWebEngineWidgets import QWebEngineView 5 | from PyQt5.QtPrintSupport import * 6 | import sys 7 | import sqlite3 8 | import time 9 | import os 10 | 11 | 12 | class InsertDialog(QDialog): 13 | def __init__(self, *args, **kwargs): 14 | super(InsertDialog, self).__init__(*args, **kwargs) 15 | 16 | self.QBtn = QPushButton() 17 | self.QBtn.setText("Register") 18 | 19 | self.setWindowTitle("Add Student") 20 | self.setFixedWidth(300) 21 | self.setFixedHeight(300) 22 | 23 | self.setWindowTitle("Insert Student Data") 24 | self.setFixedWidth(300) 25 | self.setFixedHeight(300) 26 | 27 | self.QBtn.clicked.connect(self.addstudent) 28 | 29 | layout = QVBoxLayout() 30 | 31 | self.nameinput = QLineEdit() 32 | self.nameinput.setPlaceholderText("Name") 33 | layout.addWidget(self.nameinput) 34 | 35 | self.branchinput = QComboBox() 36 | self.branchinput.addItem("Chemical Engg") 37 | self.branchinput.addItem("Civil") 38 | self.branchinput.addItem("Electrical") 39 | self.branchinput.addItem("Electronics and Communication") 40 | self.branchinput.addItem("Computer Engineering") 41 | self.branchinput.addItem("Information Technology") 42 | layout.addWidget(self.branchinput) 43 | 44 | self.seminput = QComboBox() 45 | self.seminput.addItem("1") 46 | self.seminput.addItem("2") 47 | self.seminput.addItem("3") 48 | self.seminput.addItem("4") 49 | self.seminput.addItem("5") 50 | self.seminput.addItem("6") 51 | self.seminput.addItem("7") 52 | self.seminput.addItem("8") 53 | layout.addWidget(self.seminput) 54 | 55 | self.mobileinput = QLineEdit() 56 | self.mobileinput.setPlaceholderText("Mobile No.") 57 | layout.addWidget(self.mobileinput) 58 | 59 | self.addressinput = QLineEdit() 60 | self.addressinput.setPlaceholderText("Address") 61 | layout.addWidget(self.addressinput) 62 | 63 | layout.addWidget(self.QBtn) 64 | self.setLayout(layout) 65 | 66 | def addstudent(self): 67 | 68 | name = "" 69 | branch = "" 70 | sem = -1 71 | mobile = "" 72 | address = "" 73 | 74 | name = self.nameinput.text() 75 | branch = self.branchinput.itemText(self.branchinput.currentIndex()) 76 | sem = self.seminput.itemText(self.seminput.currentIndex()) 77 | mobile = self.mobileinput.text() 78 | address = self.addressinput.text() 79 | try: 80 | self.conn = sqlite3.connect("database.db") 81 | self.c = self.conn.cursor() 82 | self.c.execute("INSERT INTO students (name,branch,sem,Mobile,address) VALUES (?,?,?,?,?)",(name,branch,sem,mobile,address)) 83 | self.conn.commit() 84 | self.c.close() 85 | self.conn.close() 86 | QMessageBox.information(QMessageBox(),'Successful','Student is added successfully to the database.') 87 | self.close() 88 | except Exception: 89 | QMessageBox.warning(QMessageBox(), 'Error', 'Could not add student to the database.') 90 | 91 | class SearchDialog(QDialog): 92 | def __init__(self, *args, **kwargs): 93 | super(SearchDialog, self).__init__(*args, **kwargs) 94 | 95 | self.QBtn = QPushButton() 96 | self.QBtn.setText("Search") 97 | 98 | self.setWindowTitle("Search user") 99 | self.setFixedWidth(300) 100 | self.setFixedHeight(100) 101 | self.QBtn.clicked.connect(self.searchstudent) 102 | layout = QVBoxLayout() 103 | 104 | self.searchinput = QLineEdit() 105 | self.onlyInt = QIntValidator() 106 | self.searchinput.setValidator(self.onlyInt) 107 | self.searchinput.setPlaceholderText("Roll No.") 108 | layout.addWidget(self.searchinput) 109 | layout.addWidget(self.QBtn) 110 | self.setLayout(layout) 111 | 112 | def searchstudent(self): 113 | 114 | searchrol = "" 115 | searchrol = self.searchinput.text() 116 | try: 117 | self.conn = sqlite3.connect("database.db") 118 | self.c = self.conn.cursor() 119 | result = self.c.execute("SELECT * from students WHERE roll="+str(searchrol)) 120 | row = result.fetchone() 121 | serachresult = "Rollno : "+str(row[0])+'\n'+"Name : "+str(row[1])+'\n'+"Branch : "+str(row[2])+'\n'+"Sem : "+str(row[3])+'\n'+"Address : "+str(row[4]) 122 | QMessageBox.information(QMessageBox(), 'Successful', serachresult) 123 | self.conn.commit() 124 | self.c.close() 125 | self.conn.close() 126 | except Exception: 127 | QMessageBox.warning(QMessageBox(), 'Error', 'Could not Find student from the database.') 128 | 129 | class DeleteDialog(QDialog): 130 | def __init__(self, *args, **kwargs): 131 | super(DeleteDialog, self).__init__(*args, **kwargs) 132 | 133 | self.QBtn = QPushButton() 134 | self.QBtn.setText("Delete") 135 | 136 | self.setWindowTitle("Delete Student") 137 | self.setFixedWidth(300) 138 | self.setFixedHeight(100) 139 | self.QBtn.clicked.connect(self.deletestudent) 140 | layout = QVBoxLayout() 141 | 142 | self.deleteinput = QLineEdit() 143 | self.onlyInt = QIntValidator() 144 | self.deleteinput.setValidator(self.onlyInt) 145 | self.deleteinput.setPlaceholderText("Roll No.") 146 | layout.addWidget(self.deleteinput) 147 | layout.addWidget(self.QBtn) 148 | self.setLayout(layout) 149 | 150 | def deletestudent(self): 151 | 152 | delrol = "" 153 | delrol = self.deleteinput.text() 154 | try: 155 | self.conn = sqlite3.connect("database.db") 156 | self.c = self.conn.cursor() 157 | self.c.execute("DELETE from students WHERE roll="+str(delrol)) 158 | self.conn.commit() 159 | self.c.close() 160 | self.conn.close() 161 | QMessageBox.information(QMessageBox(),'Successful','Deleted From Table Successful') 162 | self.close() 163 | except Exception: 164 | QMessageBox.warning(QMessageBox(), 'Error', 'Could not Delete student from the database.') 165 | 166 | 167 | 168 | 169 | 170 | 171 | class AboutDialog(QDialog): 172 | def __init__(self, *args, **kwargs): 173 | super(AboutDialog, self).__init__(*args, **kwargs) 174 | 175 | self.setFixedWidth(500) 176 | self.setFixedHeight(250) 177 | 178 | QBtn = QDialogButtonBox.Ok 179 | self.buttonBox = QDialogButtonBox(QBtn) 180 | self.buttonBox.accepted.connect(self.accept) 181 | self.buttonBox.rejected.connect(self.reject) 182 | 183 | layout = QVBoxLayout() 184 | 185 | self.setWindowTitle("About") 186 | title = QLabel("Student Record Maintainer In PyQt5") 187 | font = title.font() 188 | font.setPointSize(20) 189 | title.setFont(font) 190 | 191 | labelpic = QLabel() 192 | pixmap = QPixmap('icon/dexter.jpg') 193 | pixmap = pixmap.scaledToWidth(275) 194 | labelpic.setPixmap(pixmap) 195 | labelpic.setFixedHeight(150) 196 | 197 | layout.addWidget(title) 198 | 199 | layout.addWidget(QLabel("v2.0")) 200 | layout.addWidget(QLabel("Copyright Okay Dexter 2019")) 201 | layout.addWidget(labelpic) 202 | 203 | 204 | layout.addWidget(self.buttonBox) 205 | 206 | self.setLayout(layout) 207 | 208 | 209 | class MainWindow(QMainWindow): 210 | def __init__(self, *args, **kwargs): 211 | super(MainWindow, self).__init__(*args, **kwargs) 212 | self.setWindowIcon(QIcon('icon/g2.png')) #window icon 213 | 214 | self.conn = sqlite3.connect("database.db") 215 | self.c = self.conn.cursor() 216 | self.c.execute("CREATE TABLE IF NOT EXISTS students(roll INTEGER PRIMARY KEY AUTOINCREMENT ,name TEXT,branch TEXT,sem INTEGER,mobile INTEGER,address TEXT)") 217 | self.c.close() 218 | 219 | file_menu = self.menuBar().addMenu("&File") 220 | 221 | help_menu = self.menuBar().addMenu("&About") 222 | self.setWindowTitle("Student Record Maintainer In PyQT5") 223 | self.setMinimumSize(800, 600) 224 | 225 | self.tableWidget = QTableWidget() 226 | self.setCentralWidget(self.tableWidget) 227 | self.tableWidget.setAlternatingRowColors(True) 228 | self.tableWidget.setColumnCount(6) 229 | self.tableWidget.horizontalHeader().setCascadingSectionResizes(False) 230 | self.tableWidget.horizontalHeader().setSortIndicatorShown(False) 231 | self.tableWidget.horizontalHeader().setStretchLastSection(True) 232 | self.tableWidget.verticalHeader().setVisible(False) 233 | self.tableWidget.verticalHeader().setCascadingSectionResizes(False) 234 | self.tableWidget.verticalHeader().setStretchLastSection(False) 235 | self.tableWidget.setHorizontalHeaderLabels(("Roll No.", "Name", "Branch", "Sem", "Mobile","Address")) 236 | 237 | toolbar = QToolBar() 238 | toolbar.setMovable(False) 239 | self.addToolBar(toolbar) 240 | 241 | statusbar = QStatusBar() 242 | self.setStatusBar(statusbar) 243 | 244 | btn_ac_adduser = QAction(QIcon("icon/add1.jpg"), "Add Student", self) #add student icon 245 | btn_ac_adduser.triggered.connect(self.insert) 246 | btn_ac_adduser.setStatusTip("Add Student") 247 | toolbar.addAction(btn_ac_adduser) 248 | 249 | btn_ac_refresh = QAction(QIcon("icon/r3.png"),"Refresh",self) #refresh icon 250 | btn_ac_refresh.triggered.connect(self.loaddata) 251 | btn_ac_refresh.setStatusTip("Refresh Table") 252 | toolbar.addAction(btn_ac_refresh) 253 | 254 | btn_ac_search = QAction(QIcon("icon/s1.png"), "Search", self) #search icon 255 | btn_ac_search.triggered.connect(self.search) 256 | btn_ac_search.setStatusTip("Search User") 257 | toolbar.addAction(btn_ac_search) 258 | 259 | btn_ac_delete = QAction(QIcon("icon/d1.png"), "Delete", self) 260 | btn_ac_delete.triggered.connect(self.delete) 261 | btn_ac_delete.setStatusTip("Delete User") 262 | toolbar.addAction(btn_ac_delete) 263 | 264 | adduser_action = QAction(QIcon("icon/add1.jpg"),"Insert Student", self) 265 | adduser_action.triggered.connect(self.insert) 266 | file_menu.addAction(adduser_action) 267 | 268 | searchuser_action = QAction(QIcon("icon/s1.png"), "Search Student", self) 269 | searchuser_action.triggered.connect(self.search) 270 | file_menu.addAction(searchuser_action) 271 | 272 | deluser_action = QAction(QIcon("icon/d1.png"), "Delete", self) 273 | deluser_action.triggered.connect(self.delete) 274 | file_menu.addAction(deluser_action) 275 | 276 | 277 | about_action = QAction(QIcon("icon/i1.png"),"Developer", self) #info icon 278 | about_action.triggered.connect(self.about) 279 | help_menu.addAction(about_action) 280 | 281 | def loaddata(self): 282 | self.connection = sqlite3.connect("database.db") 283 | query = "SELECT * FROM students" 284 | result = self.connection.execute(query) 285 | self.tableWidget.setRowCount(0) 286 | for row_number, row_data in enumerate(result): 287 | self.tableWidget.insertRow(row_number) 288 | for column_number, data in enumerate(row_data): 289 | self.tableWidget.setItem(row_number, column_number,QTableWidgetItem(str(data))) 290 | self.connection.close() 291 | 292 | def handlePaintRequest(self, printer): 293 | document = QTextDocument() 294 | cursor = QTextCursor(document) 295 | model = self.table.model() 296 | table = cursor.insertTable( 297 | model.rowCount(), model.columnCount()) 298 | for row in range(table.rows()): 299 | for column in range(table.columns()): 300 | cursor.insertText(model.item(row, column).text()) 301 | cursor.movePosition(QTextCursor.NextCell) 302 | document.print_(printer) 303 | 304 | def insert(self): 305 | dlg = InsertDialog() 306 | dlg.exec_() 307 | 308 | def delete(self): 309 | dlg = DeleteDialog() 310 | dlg.exec_() 311 | 312 | def search(self): 313 | dlg = SearchDialog() 314 | dlg.exec_() 315 | 316 | def about(self): 317 | dlg = AboutDialog() 318 | dlg.exec_() 319 | 320 | 321 | app = QApplication(sys.argv) 322 | if(QDialog.Accepted == True): 323 | window = MainWindow() 324 | window.show() 325 | window.loaddata() 326 | sys.exit(app.exec_()) 327 | --------------------------------------------------------------------------------