Skip to content

Commit

Permalink
v2.0
Browse files Browse the repository at this point in the history
mglsj authored Mar 18, 2022
1 parent 5a5b1b7 commit 37deb9c
Showing 22 changed files with 1,076 additions and 935 deletions.
4 changes: 0 additions & 4 deletions Credentials.txt

This file was deleted.

6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -28,6 +28,10 @@ pip install pillow
```sh
pip install cryptography
```
- Playsound
```sh
pip install playsound
```
<h3>Authentication</h3>

Enter your MySQL connection details on the credentials window
@@ -44,4 +48,4 @@ Open main.py in a python compiler of choice.

<b>OR</b>

Click on run.exe
Click on main.exe
Binary file added main.exe
Binary file not shown.
289 changes: 179 additions & 110 deletions main.py
Original file line number Diff line number Diff line change
@@ -1,118 +1,187 @@
from tkinter import *
from PIL import ImageTk,Image
import pymysql
from tkinter import messagebox,ttk
import PIL.Image, PIL.ImageTk

from modules.AddBook import *
from modules.DeleteBook import *
from modules.ViewBooks import *
from modules.Sounds import click
from modules.IssueBook import *
from modules.ReturnBook import *

root = Tk()

root.title("Library Manager AVBIL")
root.minsize(848, 480)
root.iconbitmap("media\logo.ico")


img = ImageTk.PhotoImage(Image.open("media\lib.png"))
Canvas = Canvas(root, width = 960, height = 540)
Canvas.pack(fill = BOTH, expand = True)
Canvas.create_image(0,0,image = img, anchor="nw")

headingFrame1 = Frame(root, bg = "#2F2F87", bd = 5)
headingFrame1.place(relx = 0.2, rely = 0.1, relwidth = 0.6, relheight = 0.16)
headingLabel = Label(headingFrame1, text="AVBIL Library Manager", bg='#121212', fg='white', font=('Segoe UI',30))
headingLabel.place(relx = 0, rely = 0, relwidth = 1, relheight =1)

status_label = Label(root, text = "Made by Lakshyajeet Jalal and Sagar Giri ", bg = "#121212", fg = "white", relief = SUNKEN, font = ('Segoe UI',10), anchor = E)
status_label.pack(fill = X, side = BOTTOM, ipady = 2)

#Button 1
btn1 = Button(root, text = "Add Book", bg = '#121212', fg = 'white', font=('Segoe UI',20), command = lambda:[click(),add_open(),addBook()])
btn1.place(relx = 0.28, rely = 0.4, relwidth = 0.45, relheight = 0.09)

def btn1_hoverin(event):
btn1["bg"] = "#222222"
btn1["font"]= 'Segoe UI',22
status_label.config(text = "Click To Add Book ")

def btn1_hoverout(event):
btn1["bg"] = "#121212"
btn1["font"]= 'Segoe UI',20
status_label.config(text = "Made by Lakshyajeet Jalal and Sagar Giri ")

btn1.bind("<Enter>", btn1_hoverin)
btn1.bind("<Leave>", btn1_hoverout)

#Button 2
btn2 = Button(root, text= "Delete Book", bg = '#121212', fg = 'white', font=('Segoe UI',20), command = lambda:[click(), del_open(),delete()])
btn2.place(relx = 0.28, rely = 0.5, relwidth = 0.45, relheight = 0.09)

def btn2_hoverin(event):
btn2["bg"] = "#222222"
btn2["font"]= 'Segoe UI',22
status_label.config(text = "Click To Delete Book ")

def btn2_hoverout(event):
btn2["bg"] = "#121212"
btn2["font"]= 'Segoe UI',20
status_label.config(text = "Made by Lakshyajeet Jalal and Sagar Giri ")

btn2.bind("<Enter>", btn2_hoverin)
btn2.bind("<Leave>", btn2_hoverout)

#Button 3
btn3 = Button(root, text= "View Book List", bg = '#121212', fg = 'white', font=('Segoe UI',20), command = lambda:[click(), view_open(), View()])
btn3.place(relx = 0.28, rely= 0.6, relwidth = 0.45,relheight = 0.09)

def btn3_hoverin(event):
btn3["bg"] = "#222222"
btn3["font"]= 'Segoe UI',22
status_label.config(text = "Click To View Book List ")

def btn3_hoverout(event):
btn3["bg"] = "#121212"
btn3["font"]= 'Segoe UI',20
status_label.config(text = "Made by Lakshyajeet Jalal and Sagar Giri ")

btn3.bind("<Enter>", btn3_hoverin)
btn3.bind("<Leave>", btn3_hoverout)

#Button 4
btn4 = Button(root, text= "Issue Book", bg = '#121212', fg = 'white', font=('Segoe UI',20), command = lambda:[click(), issue_open(), issueBook()])
btn4.place(relx = 0.28, rely= 0.7, relwidth = 0.45,relheight = 0.09)

def btn4_hoverin(event):
btn4["bg"] = "#222222"
btn4["font"]= 'Segoe UI',22
status_label.config(text = "Click To Issue Book ")

def btn4_hoverout(event):
btn4["bg"] = "#121212"
btn4["font"]= 'Segoe UI',20
status_label.config(text = "Made by Lakshyajeet Jalal and Sagar Giri ")

btn4.bind("<Enter>", btn4_hoverin)
btn4.bind("<Leave>", btn4_hoverout)

#Button 5
btn5 = Button(root, text= "Return Book", bg= '#121212', fg = 'white', font=('Segoe UI',20), command = lambda:[click(), rtn_open(), returnBook()])
btn5.place(relx = 0.28, rely= 0.8, relwidth = 0.45,relheight = 0.09)

def btn5_hoverin(event):
btn5["bg"] = "#222222"
btn5["font"]= 'Segoe UI',22
status_label.config(text = "Click To Return Book ")

def btn5_hoverout(event):
btn5["bg"] = "#121212"
btn5["font"]= 'Segoe UI',20
status_label.config(text = "Made by Lakshyajeet Jalal and Sagar Giri ")

btn5.bind("<Enter>", btn5_hoverin)
btn5.bind("<Leave>", btn5_hoverout)

root.mainloop()
from modules.Credentials import *

if check_cred():

# Check clear
add_close()
del_close()
issue_close()
rtn_close()
view_close()

root = Tk()

root.title("Library Manager AVBIL")
root.minsize(848, 480)
root.iconbitmap("media\logo.ico")

img = PIL.ImageTk.PhotoImage(PIL.Image.open("media\lib.png"))
Canvas = Canvas(root, width=960, height=540)
Canvas.pack(fill=BOTH, expand=True)
Canvas.create_image(0, 0, image=img, anchor="nw")

# Heading Frame
headingFrame1 = Frame(root, bg="#2F2F87", bd=5)
headingFrame1.place(relx=0.2, rely=0.1, relwidth=0.6, relheight=0.16)

# Heading Label
headingLabel = Label(
headingFrame1,
text="AVBIL Library Manager",
bg="#121212",
fg="white",
font=("Segoe UI", 30),
)
headingLabel.place(relx=0, rely=0, relwidth=1, relheight=1)

# Status Label
status_label = Label(
root,
text="Made by Lakshyajeet Jalal and Sagar Giri ",
bg="#121212",
fg="white",
relief=SUNKEN,
font=("Segoe UI", 10),
anchor=E,
)
status_label.pack(fill=X, side=BOTTOM, ipady=2)

# Status Label reset
def status_label_rst():
status_label.config(text="Made by Lakshyajeet Jalal and Sagar Giri ")

# addBook Button
addBookBtn = Button(
root,
text="Add Book",
bg="#121212",
fg="white",
font=("Segoe UI", 20),
command=lambda: [click(), add_open(), addBookWin()],
)
addBookBtn.place(relx=0.28, rely=0.4, relwidth=0.45, relheight=0.09)

def addBookBtn_hoverin(event):
addBookBtn["bg"] = "#222222"
addBookBtn["font"] = "Segoe UI", 22
status_label.config(text="Click To Add Book ")

def addBookBtn_hoverout(event):
addBookBtn["bg"] = "#121212"
addBookBtn["font"] = "Segoe UI", 20
status_label_rst()

addBookBtn.bind("<Enter>", addBookBtn_hoverin)
addBookBtn.bind("<Leave>", addBookBtn_hoverout)

# delBook Button
delBookBtn = Button(
root,
text="Delete Book",
bg="#121212",
fg="white",
font=("Segoe UI", 20),
command=lambda: [click(), del_open(), deleteBookWin()],
)
delBookBtn.place(relx=0.28, rely=0.5, relwidth=0.45, relheight=0.09)

def delBookBtn_hoverin(event):
delBookBtn["bg"] = "#222222"
delBookBtn["font"] = "Segoe UI", 22
status_label.config(text="Click To Delete Book ")

def delBookBtn_hoverout(event):
delBookBtn["bg"] = "#121212"
delBookBtn["font"] = "Segoe UI", 20
status_label_rst()

delBookBtn.bind("<Enter>", delBookBtn_hoverin)
delBookBtn.bind("<Leave>", delBookBtn_hoverout)

# viewBook Button
viewBookBtn = Button(
root,
text="View Book List",
bg="#121212",
fg="white",
font=("Segoe UI", 20),
command=lambda: [click(), view_open(), View()],
)
viewBookBtn.place(relx=0.28, rely=0.6, relwidth=0.45, relheight=0.09)

def viewBookBtn_hoverin(event):
viewBookBtn["bg"] = "#222222"
viewBookBtn["font"] = "Segoe UI", 22
status_label.config(text="Click To View Book List ")

def viewBookBtn_hoverout(event):
viewBookBtn["bg"] = "#121212"
viewBookBtn["font"] = "Segoe UI", 20
status_label_rst()

viewBookBtn.bind("<Enter>", viewBookBtn_hoverin)
viewBookBtn.bind("<Leave>", viewBookBtn_hoverout)

# issueBook Button
issueBookBtn = Button(
root,
text="Issue Book",
bg="#121212",
fg="white",
font=("Segoe UI", 20),
command=lambda: [click(), issue_open(), issueBook()],
)
issueBookBtn.place(relx=0.28, rely=0.7, relwidth=0.45, relheight=0.09)

def issueBookBtn_hoverin(event):
issueBookBtn["bg"] = "#222222"
issueBookBtn["font"] = "Segoe UI", 22
status_label.config(text="Click To Issue Book ")

def issueBookBtn_hoverout(event):
issueBookBtn["bg"] = "#121212"
issueBookBtn["font"] = "Segoe UI", 20
status_label_rst()

issueBookBtn.bind("<Enter>", issueBookBtn_hoverin)
issueBookBtn.bind("<Leave>", issueBookBtn_hoverout)

# returnBook Button
returnBookBtn = Button(
root,
text="Return Book",
bg="#121212",
fg="white",
font=("Segoe UI", 20),
command=lambda: [click(), rtn_open(), returnBook()],
)
returnBookBtn.place(relx=0.28, rely=0.8, relwidth=0.45, relheight=0.09)

def returnBookBtn_hoverin(event):
returnBookBtn["bg"] = "#222222"
returnBookBtn["font"] = "Segoe UI", 22
status_label.config(text="Click To Return Book ")

def returnBookBtn_hoverout(event):
returnBookBtn["bg"] = "#121212"
returnBookBtn["font"] = "Segoe UI", 20
status_label_rst()

returnBookBtn.bind("<Enter>", returnBookBtn_hoverin)
returnBookBtn.bind("<Leave>", returnBookBtn_hoverout)

def confirm():
if messagebox.askyesno(title="Confirm", message="Are you sure that you want to quit?"):
root.destroy()

root.protocol("WM_DELETE_WINDOW", lambda: [click(), confirm()])
root.mainloop()
Loading

0 comments on commit 37deb9c

Please sign in to comment.