Assignment 4
Unique No:
Due 16 September 2025
,INF2611 Assignment 4
Question 1 (40 marks)
Question:
Design a 4-page GUI of your own choice using Qt Designer. The first page should be a
login screen with username and password. The remaining three pages should feature a
custom user interface of your choice, incorporating widgets, a calendar, and a graphic
logo. Use file handling or MySQLdb. Paste the .py code of each GUI (GUI code 1–4)
and include screenshots.
Answer: Question 1
Below is the Python source code for the four GUIs.
👉 Important: In GUI 1 (login screen), replace InsertYourSurname and
InsertYourStudentNumber with your actual surname and student number before
running. Otherwise, the login will fail.
GUI code 1 – Login screen (gui1_login.py)
# GUI code 1 - gui1_login.py
from PyQt5.QtWidgets import (
QWidget, QLabel, QLineEdit, QPushButton, QVBoxLayout, QHBoxLayout,
QMessageBox
)
from PyQt5.QtGui import QFont, QPixmap
from PyQt5.QtCore import Qt
# Replace with your OWN surname and student number
EXPECTED_USERNAME = "InsertYourSurname"
EXPECTED_PASSWORD = "InsertYourStudentNumber"
class LoginPage(QWidget):
, def __init__(self, goto_dashboard_callback, logo_path="logo.png"):
super().__init__()
self.goto_dashboard = goto_dashboard_callback
self.logo_path = logo_path
self.init_ui()
def init_ui(self):
self.setWindowTitle("Login - Student System")
layout = QVBoxLayout()
layout.setAlignment(Qt.AlignCenter)
# Logo (optional)
try:
pix = QPixmap(self.logo_path)
if not pix.isNull():
logo = QLabel()
logo.setPixmap(pix.scaledToWidth(200, Qt.SmoothTransformation))
logo.setAlignment(Qt.AlignCenter)
layout.addWidget(logo)
except Exception:
pass
title = QLabel("Student Management System")
title.setFont(QFont("Arial", 16))
title.setAlignment(Qt.AlignCenter)
layout.addWidget(title)
# Username field
user_h = QHBoxLayout()
user_lbl = QLabel("Username:")
self.user_edit = QLineEdit()