Assignment 4
Unique No:
Due 16 September 2025
,INF2611 – Assignment 4
Question 1 (40 marks)
Question
Create a four-page Graphical User Interface (GUI) using Qt Designer.
Page 1 must serve as a login screen with fields for username and password.
The other three pages should each implement a custom user interface of your
choice, and must include:
o the use of various widgets,
o a calendar component,
o and the display of a graphic logo.
Integrate file handling or MySQLdb for data storage.
Provide the .py source code for each GUI file (GUI code 1–4) and screenshots.
Answer to Question 1
Below is a working Python implementation of the four GUIs.
⚠️Note: For the first page (login), replace
InsertYourSurname and InsertYourStudentNumber with your own surname (username)
and student number (password). If this step is skipped, login validation will not
succeed.
GUI Code 1 – Login Screen (gui1_login.py)
# gui1_login.py
# GUI Page 1: Login screen
from PyQt5.QtWidgets import (
QWidget, QLabel, QLineEdit, QPushButton, QVBoxLayout, QHBoxLayout,
QMessageBox
, )
from PyQt5.QtGui import QFont, QPixmap
from PyQt5.QtCore import Qt
# Credentials (replace with your own)
EXPECTED_USERNAME = "InsertYourSurname"
EXPECTED_PASSWORD = "InsertYourStudentNumber"
class LoginPage(QWidget):
def __init__(self, on_success_callback, logo_path="logo.png"):
super().__init__()
self.on_success_callback = on_success_callback
self.logo_path = logo_path
self.build_ui()
def build_ui(self):
self.setWindowTitle("Student Portal - Login")
layout = QVBoxLayout()
layout.setAlignment(Qt.AlignCenter)
# Logo area (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