1. Create a database console application to perform the following applications:
a) Define a dictionary to store details for library books consisting of book id, title, author name, year of publication and publisher.
b) Show how the information can be stored in a SQLite or MySQL database named books, retrieved by book id or author name, update using any book id or title and deleted using book id or title.
c) Handle all exceptions and validate data entry.
2. Redo question 1. above converting the application into a user-friendly GUI application using a python GUI library such as Tkinter and develop all operations stated above while connecting to the same database named books.
a)
class BookFormat(Enum):
HARDCOVER, PAPERBACK, AUDIO_BOOK, EBOOK, NEWSPAPER, MAGAZINE, JOURNAL = 1, 2, 3, 4, 5, 6, 7
class BookStatus(Enum):
AVAILABLE, RESERVED, LOANED, LOST = 1, 2, 3, 4
class ReservationStatus(Enum):
WAITING, PENDING, CANCELED, NONE = 1, 2, 3, 4
class AccountStatus(Enum):
ACTIVE, CLOSED, CANCELED, BLACKLISTED, NONE = 1, 2, 3, 4, 5
class Address:
def __init__(self, street, city, state, zip_code, country):
self.__street_address = street
self.__city = city
self.__state = state
self.__zip_code = zip_code
self.__country = country
class Person(ABC):
def __init__(self, name, address, email, phone):
self.__name = name
self.__address = address
self.__email = email
self.__phone = phone
class Constants:
self.MAX_BOOKS_ISSUED_TO_A_USER = 5
self.MAX_LENDING_DAYS = 10
b)
from tkinter import *
from PIL import ImageTk,Image
from tkinter import messagebox
import pymysq
mypass = "root"
mydatabase="db"
con = pymysql.connect( host="localhost",user="root",password=mypass,database=mydatabase)
cur = con.cursor()
# Enter Table Names here
bookTable = "boo
Comments
Leave a comment