0% found this document useful (0 votes)
4 views36 pages

Project Format (1)

dddd

Uploaded by

visheshgurung17
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
Download as docx, pdf, or txt
0% found this document useful (0 votes)
4 views36 pages

Project Format (1)

dddd

Uploaded by

visheshgurung17
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1/ 36

SAGAR PUBLIC SCHOOL, GANDHI NAGAR,

BHOPAL

SESSION - 2024-25
CLASS XII

ALL INDIA SENIOR SCHOOL CERTIFICATE


EXAMINATION

INFORMATICS PRACTICES (065)

PROJECT FILE
ON
Tourist Spot Explorer Using Python and MySQL

SUBMITTED TO SUBMITTED BY
Ms. Faraz Rasheed Name: Vishesh Gurung
Class: XII - Science
Board Roll No.:
CERTIFICATE

This is to certify that Vishesh Gurung, Roll no.


of class 12th ‘Science’ has successfully completed his Project
file of IP (Informatics Practices (065)) for the AISSCE (All
India Senior School Certificate Examination) as prescribed by
CBSE (Central Board of Secondary Education) in the session
2024-2025.

Signature of Internal Examiner Signature of External Examiner

Signature of Principal School Stamp


ACKNOWLEDGEMENT

I would like to express my sincere gratitude to The Principal,


Ms. Alpa Prabhu, The Management and my teacher Ms. Faraz
Rasheed who gave me the opportunity to work on this wonderful
project on the topic “Tourist Spot Explorer Using
Python and MySQL”, which helped me in doing research
and I come to know about many new things.
I would also like to thank my parents and friends who helped me
in finalizing this project.
Content
S.No. Topic Page No.
1 1-3
Introduction
.
2 Hardware and Software
. requirement
3 Python Code
.
4 Creating Table/Creating CSV
.
5 Output
.
6 Bibliography
.
INTRODUCTION
Python
Python is an interpreted, object-oriented, high-level programming
language with dynamic semantics. Its high-level built in data structures,
combined with dynamic typing and dynamic binding, make it very
attractive for Rapid Application Development, as well as for use as a
scripting or glue language to connect existing components together.
Python's simple, easy to learn syntax emphasizes readability and
therefore reduces the cost of program maintenance. Python supports
modules and packages, which encourages program modularity and code
reuse. The Python interpreter and the extensive standard library are
available in source or binary form without charge for all major
platforms, and can be freely distributed.
Often, programmers fall in love with Python because of the increased
productivity it provides. Since there is no compilation step, the edit-test-
debug cycle is incredibly fast. Debugging Python programs is easy: a
bug or bad input will never cause a segmentation fault. Instead, when the
interpreter discovers an error, it raises an exception. When the program
doesn't catch the exception, the interpreter prints a stack trace. A source
level debugger allows inspection of local and global variables,
evaluation of arbitrary expressions, setting breakpoints, stepping through
the code a line at a time, and so on. The debugger is written in Python
itself, testifying to Python's introspective power. On the other hand,
often the quickest way to debug a program is to add a few print
statements to the source: the fast edit-test-debug cycle makes this simple
approach very effective.
MySQL
MySQL is the world’s second most widely used Open-source Relational
Database Management System (RDBMS). It is named after its co-
founder Michael Widenius’s daughter, MySQL(Structured Query
Language) is a database computer language designed for managing data
in relational database management systems.
It is a fast, easy-to-use RDBMS being used for many small and big
businesses. Its development began in 1994 by a Swedish company,
MySQL AB. MySQL is a leading open-source, multi-user Database
Management System. It is used by Wikipedia, YouTube, Facebook. These
sites manage millions of queries each day.
MySQL runs on more than 20 platforms including Linux, Windows,
MAC OS X, Unix, Netware. Sun Microsystems acquired MySQL AB in
2008. Sun was bought by Oracle in 2010. So today, Oracle Corporation
is the owner of the MySQL database. It is developed in C/C++. The
developers release minor updates of the MySQL Server approximately
every two months.
Major features as available in MySQL 5.7:
 Cross- platform support
 Updatable views
 Information schema
 Performance schema
 Embedded database library
CSV:
A comma-separated values (CSV) file is a delimited text file that uses a
comma to separate values. Each line of the file is a
data record. Each record consists of one or more fields, separated by
commas. The use of the comma as a field separator is the source of the
name for this file format. A CSV file typically stores tabular data
(numbers and text) in plain text, in which case each line will have the
same number of fields.
The CSV file format is not fully standardized. Separating fields with
commas is the foundation, but commas in the data or embedded line
breaks have to be handled specially. Some implementations disallow
such content while others surround the field with quotation marks,
which yet again creates the need for escaping if quotation marks are
present in the data.
Hardware and Software Requirements
Minimum Requirement:(Python version supported-3.8)

1) Operating System: Linux- Windows 7

2) Processor-Pentium

3) RAM-2GB

4) All libraries and packages used in Python

5) MYSQL
Packages used in this Project

1) Pandas
2) NumPy
3) Matplotlib
Python Code
form.show()
sys.exit(app.exec_
())

 Creating Main Panel


from PyQt5 import QtGui

from PyQt5.QtCore import QDateTime, Qt, QTimer

from PyQt5.QtWidgets import (QApplication, QCheckBox,


QComboBox, QDateTimeEdit,
QDial, QDialog, QGridLayout, QGroupBox, QHBoxLayout,
QLabel, QLineEdit,
QProgressBar, QPushButton, QRadioButton,
QScrollBar, QSizePolicy,
QSlider, QSpinBox, QStyleFactory, QTableWidget, QTabWidget,
QTextEdit,
QVBoxLayout, QWidget)

class WidgetGallery(QDialog):
def init (self, parent=None):

super(WidgetGallery, self). init (parent)

self.originalPalette =
QApplication.palette()
self.setWindowTitle('Home')
styleComboBox = QComboBox()
styleComboBox.addItems(QStyleFactory.keys())

styleLabel = QLabel("&Style:")
styleLabel.setBuddy(styleComboBox)

self.useStylePaletteCheckBox = QCheckBox("&Use style's


standard palette")
self.useStylePaletteCheckBox.setChecked(True)

disableWidgetsCheckBox = QCheckBox("&Disable widgets")

self.createTopLeftGroupBox()
self.createTopRightGroupBox()
styleComboBox.activated[str].connect(self.changeStyle)
self.useStylePaletteCheckBox.toggled.connect(self.changeP
alette)
disableWidgetsCheckBox.toggled.connect(self.topLeftGrou
pBox.set
Disabled)
disableWidgetsCheckBox.toggled.connect(self.topRightGroupBox.
s etDisabled)

topLayout = QHBoxLayout()
topLayout.addWidget(styleLabel)
topLayout.addWidget(styleComboBox)
topLayout.addStretch(1)
topLayout.addWidget(self.useStylePaletteCheckBox)
topLayout.addWidget(disableWidgetsCheckBox)

mainLayout = QGridLayout()
mainLayout.addLayout(topLayout, 0,
0, 1, 2)
mainLayout.addWidget(self.topLeftGroupBox, 1, 0)
mainLayout.addWidget(self.topRightGroupBox, 1, 1)
mainLayout.setColumnStretch(0, 1)
mainLayout.setColumnStretch(
1, 2)
self.setLayout(mainLayout)

self.setWindowTitle("Styles")
self.changeStyle('Fusion')

def changeStyle(self, styleName):


QApplication.setStyle(QStyleFactory.create(styleName))
self.changePalette()
def changePalette(self):
if (self.useStylePaletteCheckBox.isChecked()):
QApplication.setPalette(QApplication.style().standardPalette())
else:
QApplication.setPalette(self.originalPalette)

def createTopLeftGroupBox(self):

self.topLeftGroupBox = QGroupBox("Add Student Data")

radioButton1 =
QRadioButton("Male")
radioButton1.setChecked(True)

radioButton2 = QRadioButton("Female")

checkBox = QCheckBox("Confirm the above


data") checkBox.setTristate(True)
checkBox.setCheckState(Qt.PartiallyChecke
d)

defaultPushButton =
QPushButton("Submit")
defaultPushButton.setDefault(True)

sutdentName =
QLabel("Name") lineEdit =
QLineEdit()

sutdentRoll = QLabel("Roll
Number") lineEditRoll =
QLineEdit()
sutdentClass =
QLabel("Class")
lineEditClass = QLineEdit()
dateTimeEdit = QDateTimeEdit(self.topLeftGroupBox)
dateTimeEdit.setDateTime(QDateTime.currentDateTime())
studentDOB = QLabel("Date and Time of
Birth") StudentGender =
QLabel("Gender") blankSpace = QLabel("
")

GoToTable = QPushButton('''Edit Table''')


GoToTable.setDefault(True)
GoToTable.setFont(QtGui.QFont("Times",weight=QtGui.QFont
.Bold
))

GoToEditor = QPushButton('''Open File in text editor''')


GoToEditor.setDefault(True)
GoToEditor.setFont(QtGui.QFont("Times",weight=QtGui.QFont.Bol
d
))
layout = QGridLayout()
layout.addWidget(sutdentName
) layout.addWidget(lineEdit)
layout.addWidget(blankSpace
)
layout.addWidget(sutdentClas
s)
layout.addWidget(lineEditClas
s)

layout.addWidget(blankSpace)

layout.addWidget(sutdentRoll)
layout.addWidget(lineEditRoll)
layout.addWidget(blankSpace)

layout.addWidget(StudentGender)
layout.addWidget(radioButton1)
layout.addWidget(radioButton2)
layout.addWidget(blankSpace)

layout.addWidget(studentDOB)
layout.addWidget(dateTimeEdit)
layout.addWidget(blankSpace)
layout.addWidget(checkBox)
layout.addWidget(defaultPushButton)
layout.addWidget(blankSpace)
layout.addWidget(GoToTable)
layout.addWidget(GoToEditor)
layout.setRowStretch(8, 1)

# layout.addStretch(1)
self.topLeftGroupBox.setLayout(layout)

textEdit = QTextEdit()
student_data =
open("data.csv", 'rt')
student_data_rt =
student_data.read()
textEdit.setPlainText(student_dat
a_rt)

tab1hbox = QHBoxLayout()
tab1hbox.setContentsMargins(5, 5,
5, 5) tab1hbox.addWidget(textEdit)
tab1.setLayout(tab1hbox)
tab2 = QWidget()
textEdit =
QTextEdit()
textEdit.setPlainText("SMS - Student Management
System \n") tab2hbox = QHBoxLayout()
tab2hbox.setContentsMargins(5, 5, 5, 5)
tab2hbox.addWidget(textEdit)
tab2.setLayout(tab2hbox)

self.topRightGroupBox.addTab(tab1, "&RAW
CSV") self.topRightGroupBox.addTab(tab2,
"&Comments")

if name == ' main

': import sys


app = QApplication(sys.argv)
gallery =
WidgetGallery()
gallery.show()
sys.exit(app.exec_())
 Creating Editing Panel
from PyQt5.QtWidgets import *
from PyQt5.QtGui import QKeySequence, QPalette,
QColor from PyQt5.QtCore import Qt
app = QApplication([])
# Force the style to be the same on all
OSs: app.setStyle("Fusion")
app.setStyleSheet("QLabel{font-size:
16pt;}")

# Now use a palette to switch to dark colors:


palette = QPalette()
palette.setColor(QPalette.Window, QColor(53,
53, 53)) palette.setColor(QPalette.WindowText,
Qt.white) palette.setColor(QPalette.Base,
QColor(25, 25, 25))
palette.setColor(QPalette.AlternateBase, QColor(53,
53, 53)) palette.setColor(QPalette.ToolTipBase,
Qt.white) palette.setColor(QPalette.ToolTipText,
Qt.white) palette.setColor(QPalette.Text, Qt.white)
palette.setColor(QPalette.Button, QColor(53, 53, 53))
palette.setColor(QPalette.ButtonText, Qt.white)
palette.setColor(QPalette.BrightText, Qt.red)
palette.setColor(QPalette.Link, QColor(42, 130, 218))
palette.setColor(QPalette.Highlight, QColor(42,
130, 218))
palette.setColor(QPalette.HighlightedText,
Qt.black) app.setPalette(palette)
app.setApplicationName("CSV
Editor") text = QPlainTextEdit()
class
MainWindow(QMainWindow):
def closeEvent(self, e):
if not
text.document().isModified(
): return
answer =
QMessageBox.question( win
dow, None,
"You have unsaved changes. Save before
closing?", QMessageBox.Save |
QMessageBox.Discard |
QMessageBox.Cancel
)
if answer &
QMessageBox.Save:
save()
elif answer &
QMessageBox.Cancel:
e.ignore()
window = MainWindow()
window.setCentralWidget(text)
file_path = None
menu =
window.menuBar().addMenu("&File")
open_action = QAction("&Open")
def open_file():
global
file_path
path = QFileDialog.getOpenFileName(window,
"Open")[0] if path:
text.setPlainText(open(path).read())
file_path = path
open_action.triggered.connect(open_file)
open_action.setShortcut(QKeySequence.Open)
menu.addAction(open_action)
save_action =
QAction("&Save") def
save():
if file_path is
None:
save_as()
else:
with open(file_path, "w")
as f:
f.write(text.toPlainText
())
text.document().setModified(False)
save_action.triggered.connect(save)
save_action.setShortcut(QKeySequence.Save)
menu.addAction(save_action)
save_as_action = QAction("Save
&As...") def save_as():
global file_path
path = QFileDialog.getSaveFileName(window, "Save
As")[0] if path:
file_path =
path save()
save_as_action.triggered.connect(save_as)
menu.addAction(save_as_action)
close = QAction("&Close")
close.triggered.connect(window.cl
ose) menu.addAction(close)
window.show()
app.exec_()
 Creating Table
#!/usr/bin/env
python #-*-
coding:utf-8 -*-
import csv

from PyQt5 import QtCore, QtGui,

QtWidgets class

MyWindow(QtWidgets.QWidget):
def init (self, fileName, parent=None):
super(MyWindow, self). init
(parent)
self.fileName = fileName

self.setWindowTitle('Editing Mode')

self.model =

QtGui.QStandardItemModel(self)

self.tableView = QtWidgets.QTableView(self)
self.tableView.setModel(self.model)
self.tableView.horizontalHeader().setStretchLastSection(True)

self.pushButtonLoad = QtWidgets.QPushButton(self)
self.pushButtonLoad.setText("Load File")
self.pushButtonLoad.clicked.connect(self.on_pushButtonLoad_
ed) click

ked)
self.pushButto ushButton(self) self.pushButtonWrite.setText("Save File")
nWrite = self.pushButtonWrite.clicked.connect(self.on_pushButtonWrite
QtWidgets.QP _clic

self.layoutVertical =
QtWidgets.QVBoxLayout(self)
self.layoutVertical.addWidget(self.tableView)
self.layoutVertical.addWidget(self.pushButto
nLoad)
self.layoutVertical.addWidget(self.pushButtonWrite)

def loadCsv(self, fileName):


with open(fileName, "r") as
fileInput: for row in
csv.reader(fileInput):
items = [
QtGui.QStandardItem(fi
eld) for field in row
]
self.model.appendRow(items)

def writeCsv(self, fileName):


with open(fileName, "w") as
fileOutput: writer =
csv.writer(fileOutput)
for rowNumber in
range(self.model.rowCount()): fields = [
self.model.data(
self.model.index(rowNumber,
columnNumber), QtCore.Qt.DisplayRole
)
for columnNumber in range(self.model.columnCount())
]
writer.writerow(fiel
ds) @QtCore.pyqtSlot()
def
on_pushButtonWrite_clicked(se
lf): self.writeCsv(self.fileName)

@QtCore.pyqtSlot()
def
on_pushButtonLoad_clicked(se
lf): self.loadCsv(self.fileName)

if name == " main


": import sys
app =
QtWidgets.QApplication(sys.argv)
app.setApplicationName('MyWindo
w')
main =
MyWindow("data.csv")
main.show()
sys.exit(app.exec_())
Output

LOGIN Page
Main Form

Record Editor
Student Database
BIBLIOGRAPHY

The information in this project has been attained from the


following sources:

1. BOOKS :

 Informatics Practices
Author-Sumita Arora
Publisher-Dhanpat Rai &Co.

2. WEBSITES :
 https://www.python.org/
 https://www.w3schools.com/
 https://www.pandas.org/
 https://www.pyplot.org/
 https://www.numpy.com/
 https://www.DataVisualisation.com/
 https://www.mysqltutorial.org/

You might also like