Skip to content

Commit d4a5256

Browse files
committed
✨ Format Code
1 parent 8d09a1d commit d4a5256

File tree

7 files changed

+387
-287
lines changed

7 files changed

+387
-287
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: "CodeQL"
2+
on:
3+
push:
4+
branches: [main]
5+
pull_request:
6+
branches: [main]
7+
schedule:
8+
- cron: "35 21 * * 1"
9+
jobs:
10+
analyze:
11+
name: Analyze
12+
runs-on: ubuntu-latest
13+
permissions:
14+
actions: read
15+
contents: read
16+
security-events: write
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
language: ["python"]
21+
steps:
22+
- name: Checkout repository
23+
uses: actions/checkout@v2
24+
- name: Initialize CodeQL
25+
uses: github/codeql-action/init@v1
26+
with:
27+
languages: ${{ matrix.language }}
28+
- name: Autobuild
29+
uses: github/codeql-action/autobuild@v1
30+
- name: Perform CodeQL Analysis
31+
uses: github/codeql-action/analyze@v1
Lines changed: 72 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,99 +1,117 @@
11
from tkinter import *
2-
from PIL import ImageTk,Image
2+
from PIL import ImageTk, Image
33
from tkinter import messagebox
44
import pymysql
55

6+
67
def bookRegister():
7-
8+
89
bid = bookInfo1.get()
910
title = bookInfo2.get()
1011
author = bookInfo3.get()
1112
status = bookInfo4.get()
1213
status = status.lower()
13-
14-
insertBooks = "insert into "+bookTable+" values('"+bid+"','"+title+"','"+author+"','"+status+"')"
14+
15+
insertBooks = (
16+
"insert into "
17+
+ bookTable
18+
+ " values('"
19+
+ bid
20+
+ "','"
21+
+ title
22+
+ "','"
23+
+ author
24+
+ "','"
25+
+ status
26+
+ "')"
27+
)
1528
try:
1629
cur.execute(insertBooks)
1730
con.commit()
18-
messagebox.showinfo('Success',"Book added successfully")
31+
messagebox.showinfo("Success", "Book added successfully")
1932
except:
20-
messagebox.showinfo("Error","Can't add data into Database")
21-
33+
messagebox.showinfo("Error", "Can't add data into Database")
34+
2235
print(bid)
2336
print(title)
2437
print(author)
2538
print(status)
2639

27-
2840
root.destroy()
29-
30-
def addBook():
31-
32-
global bookInfo1,bookInfo2,bookInfo3,bookInfo4,Canvas1,con,cur,bookTable,root
33-
41+
42+
43+
def addBook():
44+
45+
global bookInfo1, bookInfo2, bookInfo3, bookInfo4, Canvas1, con, cur, bookTable, root
46+
3447
root = Tk()
3548
root.title("Library")
36-
root.minsize(width=400,height=400)
49+
root.minsize(width=400, height=400)
3750
root.geometry("600x500")
3851

3952
# Add your own database name and password here to reflect in the code
4053
mypass = "root"
41-
mydatabase="db"
54+
mydatabase = "db"
4255

43-
con = pymysql.connect(host="localhost",user="root",password=mypass,database=mydatabase)
56+
con = pymysql.connect(
57+
host="localhost", user="root", password=mypass, database=mydatabase
58+
)
4459
cur = con.cursor()
4560

4661
# Enter Table Names here
47-
bookTable = "books" # Book Table
62+
bookTable = "books" # Book Table
4863

4964
Canvas1 = Canvas(root)
50-
65+
5166
Canvas1.config(bg="#ff6e40")
52-
Canvas1.pack(expand=True,fill=BOTH)
53-
54-
headingFrame1 = Frame(root,bg="#FFBB00",bd=5)
55-
headingFrame1.place(relx=0.25,rely=0.1,relwidth=0.5,relheight=0.13)
67+
Canvas1.pack(expand=True, fill=BOTH)
68+
69+
headingFrame1 = Frame(root, bg="#FFBB00", bd=5)
70+
headingFrame1.place(relx=0.25, rely=0.1, relwidth=0.5, relheight=0.13)
5671

57-
headingLabel = Label(headingFrame1, text="Add Books", bg='black', fg='white', font=('Courier',15))
58-
headingLabel.place(relx=0,rely=0, relwidth=1, relheight=1)
72+
headingLabel = Label(
73+
headingFrame1, text="Add Books", bg="black", fg="white", font=("Courier", 15)
74+
)
75+
headingLabel.place(relx=0, rely=0, relwidth=1, relheight=1)
5976

77+
labelFrame = Frame(root, bg="black")
78+
labelFrame.place(relx=0.1, rely=0.4, relwidth=0.8, relheight=0.4)
6079

61-
labelFrame = Frame(root,bg='black')
62-
labelFrame.place(relx=0.1,rely=0.4,relwidth=0.8,relheight=0.4)
63-
6480
# Book ID
65-
lb1 = Label(labelFrame,text="Book ID : ", bg='black', fg='white')
66-
lb1.place(relx=0.05,rely=0.2, relheight=0.08)
67-
81+
lb1 = Label(labelFrame, text="Book ID : ", bg="black", fg="white")
82+
lb1.place(relx=0.05, rely=0.2, relheight=0.08)
83+
6884
bookInfo1 = Entry(labelFrame)
69-
bookInfo1.place(relx=0.3,rely=0.2, relwidth=0.62, relheight=0.08)
70-
85+
bookInfo1.place(relx=0.3, rely=0.2, relwidth=0.62, relheight=0.08)
86+
7187
# Title
72-
lb2 = Label(labelFrame,text="Title : ", bg='black', fg='white')
73-
lb2.place(relx=0.05,rely=0.35, relheight=0.08)
74-
88+
lb2 = Label(labelFrame, text="Title : ", bg="black", fg="white")
89+
lb2.place(relx=0.05, rely=0.35, relheight=0.08)
90+
7591
bookInfo2 = Entry(labelFrame)
76-
bookInfo2.place(relx=0.3,rely=0.35, relwidth=0.62, relheight=0.08)
77-
92+
bookInfo2.place(relx=0.3, rely=0.35, relwidth=0.62, relheight=0.08)
93+
7894
# Book Author
79-
lb3 = Label(labelFrame,text="Author : ", bg='black', fg='white')
80-
lb3.place(relx=0.05,rely=0.50, relheight=0.08)
81-
95+
lb3 = Label(labelFrame, text="Author : ", bg="black", fg="white")
96+
lb3.place(relx=0.05, rely=0.50, relheight=0.08)
97+
8298
bookInfo3 = Entry(labelFrame)
83-
bookInfo3.place(relx=0.3,rely=0.50, relwidth=0.62, relheight=0.08)
84-
99+
bookInfo3.place(relx=0.3, rely=0.50, relwidth=0.62, relheight=0.08)
100+
85101
# Book Status
86-
lb4 = Label(labelFrame,text="Status(Avail/issued) : ", bg='black', fg='white')
87-
lb4.place(relx=0.05,rely=0.65, relheight=0.08)
88-
102+
lb4 = Label(labelFrame, text="Status(Avail/issued) : ", bg="black", fg="white")
103+
lb4.place(relx=0.05, rely=0.65, relheight=0.08)
104+
89105
bookInfo4 = Entry(labelFrame)
90-
bookInfo4.place(relx=0.3,rely=0.65, relwidth=0.62, relheight=0.08)
91-
92-
#Submit Button
93-
SubmitBtn = Button(root,text="SUBMIT",bg='#d1ccc0', fg='black',command=bookRegister)
94-
SubmitBtn.place(relx=0.28,rely=0.9, relwidth=0.18,relheight=0.08)
95-
96-
quitBtn = Button(root,text="Quit",bg='#f7f1e3', fg='black', command=root.destroy)
97-
quitBtn.place(relx=0.53,rely=0.9, relwidth=0.18,relheight=0.08)
98-
106+
bookInfo4.place(relx=0.3, rely=0.65, relwidth=0.62, relheight=0.08)
107+
108+
# Submit Button
109+
SubmitBtn = Button(
110+
root, text="SUBMIT", bg="#d1ccc0", fg="black", command=bookRegister
111+
)
112+
SubmitBtn.place(relx=0.28, rely=0.9, relwidth=0.18, relheight=0.08)
113+
114+
quitBtn = Button(root, text="Quit", bg="#f7f1e3", fg="black", command=root.destroy)
115+
quitBtn.place(relx=0.53, rely=0.9, relwidth=0.18, relheight=0.08)
116+
99117
root.mainloop()
Lines changed: 48 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,77 +1,82 @@
11
from tkinter import *
2-
from PIL import ImageTk,Image
2+
from PIL import ImageTk, Image
33
from tkinter import messagebox
44
import pymysql
55

66
# Add your own database name and password here to reflect in the code
77
mypass = "root"
8-
mydatabase="db"
8+
mydatabase = "db"
99

10-
con = pymysql.connect(host="localhost",user="root",password=mypass,database=mydatabase)
10+
con = pymysql.connect(
11+
host="localhost", user="root", password=mypass, database=mydatabase
12+
)
1113
cur = con.cursor()
1214

1315
# Enter Table Names here
14-
issueTable = "books_issued"
15-
bookTable = "books" #Book Table
16+
issueTable = "books_issued"
17+
bookTable = "books" # Book Table
1618

1719

1820
def deleteBook():
19-
21+
2022
bid = bookInfo1.get()
21-
22-
deleteSql = "delete from "+bookTable+" where bid = '"+bid+"'"
23-
deleteIssue = "delete from "+issueTable+" where bid = '"+bid+"'"
23+
24+
deleteSql = "delete from " + bookTable + " where bid = '" + bid + "'"
25+
deleteIssue = "delete from " + issueTable + " where bid = '" + bid + "'"
2426
try:
2527
cur.execute(deleteSql)
2628
con.commit()
2729
cur.execute(deleteIssue)
2830
con.commit()
29-
messagebox.showinfo('Success',"Book Record Deleted Successfully")
31+
messagebox.showinfo("Success", "Book Record Deleted Successfully")
3032
except:
3133
messagebox.showinfo("Please check Book ID")
32-
3334

3435
print(bid)
3536

3637
bookInfo1.delete(0, END)
3738
root.destroy()
38-
39-
def delete():
40-
41-
global bookInfo1,bookInfo2,bookInfo3,bookInfo4,Canvas1,con,cur,bookTable,root
42-
39+
40+
41+
def delete():
42+
43+
global bookInfo1, bookInfo2, bookInfo3, bookInfo4, Canvas1, con, cur, bookTable, root
44+
4345
root = Tk()
4446
root.title("Library")
45-
root.minsize(width=400,height=400)
47+
root.minsize(width=400, height=400)
4648
root.geometry("600x500")
4749

48-
4950
Canvas1 = Canvas(root)
50-
51+
5152
Canvas1.config(bg="#006B38")
52-
Canvas1.pack(expand=True,fill=BOTH)
53-
54-
headingFrame1 = Frame(root,bg="#FFBB00",bd=5)
55-
headingFrame1.place(relx=0.25,rely=0.1,relwidth=0.5,relheight=0.13)
56-
57-
headingLabel = Label(headingFrame1, text="Delete Book", bg='black', fg='white', font=('Courier',15))
58-
headingLabel.place(relx=0,rely=0, relwidth=1, relheight=1)
59-
60-
labelFrame = Frame(root,bg='black')
61-
labelFrame.place(relx=0.1,rely=0.3,relwidth=0.8,relheight=0.5)
62-
53+
Canvas1.pack(expand=True, fill=BOTH)
54+
55+
headingFrame1 = Frame(root, bg="#FFBB00", bd=5)
56+
headingFrame1.place(relx=0.25, rely=0.1, relwidth=0.5, relheight=0.13)
57+
58+
headingLabel = Label(
59+
headingFrame1, text="Delete Book", bg="black", fg="white", font=("Courier", 15)
60+
)
61+
headingLabel.place(relx=0, rely=0, relwidth=1, relheight=1)
62+
63+
labelFrame = Frame(root, bg="black")
64+
labelFrame.place(relx=0.1, rely=0.3, relwidth=0.8, relheight=0.5)
65+
6366
# Book ID to Delete
64-
lb2 = Label(labelFrame,text="Book ID : ", bg='black', fg='white')
65-
lb2.place(relx=0.05,rely=0.5)
66-
67+
lb2 = Label(labelFrame, text="Book ID : ", bg="black", fg="white")
68+
lb2.place(relx=0.05, rely=0.5)
69+
6770
bookInfo1 = Entry(labelFrame)
68-
bookInfo1.place(relx=0.3,rely=0.5, relwidth=0.62)
69-
70-
#Submit Button
71-
SubmitBtn = Button(root,text="SUBMIT",bg='#d1ccc0', fg='black',command=deleteBook)
72-
SubmitBtn.place(relx=0.28,rely=0.9, relwidth=0.18,relheight=0.08)
73-
74-
quitBtn = Button(root,text="Quit",bg='#f7f1e3', fg='black', command=root.destroy)
75-
quitBtn.place(relx=0.53,rely=0.9, relwidth=0.18,relheight=0.08)
76-
77-
root.mainloop()
71+
bookInfo1.place(relx=0.3, rely=0.5, relwidth=0.62)
72+
73+
# Submit Button
74+
SubmitBtn = Button(
75+
root, text="SUBMIT", bg="#d1ccc0", fg="black", command=deleteBook
76+
)
77+
SubmitBtn.place(relx=0.28, rely=0.9, relwidth=0.18, relheight=0.08)
78+
79+
quitBtn = Button(root, text="Quit", bg="#f7f1e3", fg="black", command=root.destroy)
80+
quitBtn.place(relx=0.53, rely=0.9, relwidth=0.18, relheight=0.08)
81+
82+
root.mainloop()

0 commit comments

Comments
 (0)