Skip to content

Commit 26134ca

Browse files
Update khata_book.py
1 parent 1c67d5e commit 26134ca

File tree

1 file changed

+21
-10
lines changed

1 file changed

+21
-10
lines changed

GUIScripts/Khata Book Management System/khata_book.py

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,38 @@
1-
import mysql.connector
1+
# Including required modules
22

3+
import mysql.connector
34
from tkinter import *
45
import speech_recognition as sr
56
import pyttsx3
67

8+
# assigining the voice commands
79
engine = pyttsx3.init('sapi5')
810
voices = engine.getProperty('voices')
911
# print(voices[1].id)
1012
engine.setProperty('voice', voices[0].id)
1113

12-
14+
# function to speak
1315
def speak(audio):
1416
engine.say(audio)
1517
engine.runAndWait()
16-
18+
# making the connections towards the mysql
1719
def connection():
1820
try:
1921
con=mysql.connector.connect(user='root',password='4844',host='127.0.0.1',database='kbook')
2022
mycursor=con.cursor()
23+
#creating the servers
2124
mycursor.execute("CREATE TABLE IF NOT EXIST ITEMS (CID INT PRIMARY KEY,COUSTOMER_NAME VARCHAR(25),ITEM1 VARCHAR(20),WORTH1 INT,ITEM2 VARCHAR(20),WORTH2 INT,TOTAL_AMOUNT INT)")
2225
except:
2326
print("cannot Connect to database")
2427
return con
2528

26-
29+
30+
# function to search records in mysql tables
2731
def Search_Records():
2832
con=connection()
2933
cursor=con.cursor()
3034
CID=e1.get()
31-
query=("select * from items where CID=%s")
35+
query=("select * from items where CID=%s") #executive the querry
3236
data=(CID,)
3337
cursor.execute(query,data)
3438
dasd = cursor.fetchall()
@@ -38,7 +42,7 @@ def Search_Records():
3842

3943

4044

41-
45+
# function to Insert records in mysql tables
4246
def Insert_Records():
4347
con=connection()
4448
cursor=con.cursor()
@@ -58,7 +62,7 @@ def Insert_Records():
5862
con.commit()
5963
con.close()
6064

61-
65+
# function to show all records in mysql tables
6266
def show_money():
6367
con=connection()
6468
cur=con.cursor()
@@ -72,7 +76,8 @@ def show_money():
7276
cur.close()
7377
con.commit()
7478
con.close()
75-
79+
80+
#Function To delete the records
7681
def delete():
7782
con=connection()
7883
cur=con.cursor()
@@ -93,17 +98,20 @@ def delete():
9398
def close():
9499
sys.exit()
95100

101+
#Starting the UI Work........
102+
96103

97104
root=Tk()
98105
root.title("KHATA BOOK SOFT")
99-
106+
#decalring the variables...
100107
CID=StringVar()
101108
Customer_Name=StringVar()
102109
Item1=StringVar()
103110
worth1=StringVar()
104111
Item2=StringVar()
105112
worth2=StringVar()
106113

114+
#making the labels for fields in UI...........
107115

108116
label1=Label(root,text="Customer ID",font="arial 10 bold")
109117
label1.place(x=0,y=0)
@@ -123,6 +131,7 @@ def close():
123131
label16=Label(root,text="worth2",font="arial 10 bold")
124132
label16.place(x=0,y=150)
125133

134+
# MAking th entry field .........
126135
e1=Entry(root,textvariable=CID,bg="lightblue")
127136
e1.place(x=120,y=0)
128137

@@ -142,10 +151,12 @@ def close():
142151
e6.place(x=120,y=150)
143152

144153

145-
154+
# OUTPUT AREA....................
146155
t1=Text(root,width=80,height=20,bg="green",font="arial 10 bold")
147156
t1.grid(row=9,column=1)
148157

158+
#Buttons That Triggers the Functions............
159+
149160
b1=Button(root,text="Seacrch CUSTOMER",command=Search_Records,width=40,bg="orange",font="arial 10 bold")
150161
b1.grid(row=11,column=0)
151162

0 commit comments

Comments
 (0)