This repository contains a library search application that helps users find information about books in a library by subject name, classmark, or location. The application is developed in two parts: a text-based console application and a graphical user interface (GUI) application using Tkinter.
- Part I: Text-Based Console Application
- Part II: Tkinter-Based GUI Application
- Common Functionality
- CSV Files
- How to Run
- Project Structure
The text-based console application allows users to search for book information by subject name, classmark, or location through the terminal.
- Prompt the user to select an option:
- Search by subject name or part-name
- Search by classmark
- Search by location
- Based on the selection, prompt the user to enter the relevant details.
- Output the matching classmark along with its location and subject name(s).
Run the console application using:
python library_search_console.py
The Tkinter-based GUI application provides a graphical interface for users to search for book information.
- Radio buttons to select the search option:
- Search by subject name or part-name
- Search by classmark
- Search by location
- Text entry for user input based on the selection.
- Display the matching classmark along with its location and subject name(s) in a text box.
Run the GUI application using:
python library_search_gui.py
The common functionality for both applications is encapsulated in library_search_common.py. This module contains functions for reading CSV files, getting locations by classmark, and retrieving subject names by classmark.
- read_csv(file_name): Reads data from a CSV file and returns it as a list.
- get_location(classmark, classmarks_data): Returns the location of a given classmark.
- get_subject_names(classmark, subjects_data): Returns a list of subject names for a given classmark.
The application relies on two CSV files:
- subjects.csv: Contains a list of subjects and classmarks.
- locations.csv: Contains a list of classmarks and locations
- Ensure you have Python installed on your system.
- Clone the repository:
git clone https://github.com/yourusername/library-search-app.git
- Navigate to the project directory:
cd library-search-app
- Ensure you have the required CSV files (subjects.csv and locations.csv) in the project directory.
- Run the console application:
python library_search_console.py
- Run the GUI application:
python library_search_gui.py
library-search-app/
│
├── library_search_common.py # Common functionality
├── library_search_console.py # Console application
├── library_search_gui.py # GUI application
├── subjects.csv # Sample subjects data
├── locations.csv # Sample locations data
└── README.md # Project documentation