-
Notifications
You must be signed in to change notification settings - Fork 0
/
bus_running_details.py
71 lines (50 loc) · 2.48 KB
/
bus_running_details.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
from tkinter import*
from tkinter import messagebox
import sqlite3
root= Tk()
root.state('zoomed')
bus_logo=PhotoImage(file=".\\images\\Bus_for_project.png")
Label(root,image = bus_logo).grid(row = 0 , column = 6,columnspan=15)
Label(root,text = "Online Bus Booking System", font = "arial 18 bold",bg = 'sky blue', fg ='Red').grid(row = 1, column = 6, pady = 20,columnspan=15)
Label(root,text = "Add Bus Running Details", font = "arial 14 bold",bg = 'light green', fg ='green').grid(row = 2, column = 6, pady = 20,columnspan=15)
Label(root,text = "Bus Id").grid(row=3 , column = 2)
bus_id=Entry(root)
bus_id.grid(row = 3 , column =3)
Label(root,text = "Running Date").grid(row=3 , column = 4)
running_date =Entry(root)
running_date.grid(row = 3 , column =5)
Label(root,text = "Seat Available").grid(row=3 , column = 6)
seat_available =Entry(root)
seat_available.grid(row = 3 , column =7)
def add_run():
con=sqlite3.Connection("Bus_database")
cur=con.cursor()
if bus_id.get()!="" and running_date.get()!="" and seat_available.get()!="" :
cur.execute("insert into running_details values('"+bus_id.get()+"','"+ running_date.get()+"','"+seat_available.get()+"')")
con.commit()
displaY()
messagebox.showinfo("","Bus Running details added successfully")
con.close()
else:
messagebox.showerror("","Please fill all the field")
Button(root, text= 'Add Run',fg ='black' ,bg= 'light green',command=add_run).grid(row= 3 ,column = 8)
def displaY():
Label(root,text=bus_id.get()+" "+running_date.get()+" "+seat_available.get()).grid(row=4,column=5)
def delete_run():
con=sqlite3.Connection("Bus_database")
cur=con.cursor()
if bus_id.get()!="" and running_date.get()!="" and seat_available.get()!="" :
cur.execute("update into running_details values('"+bus_id.get()+"','"+ running_date.get()+"','"+seat_available.get()+"')")
con.commit()
displaY()
messagebox.showinfo("","Bus Running details deleted successfully")
con.close()
else:
messagebox.showerror("","Please fill all the field")
Button(root, text= 'Delete Run',fg ='black',bg='Red',command=delete_run).grid(row= 3 ,column = 10)
def home():
root.destroy()
import add_bus_details
home_logo =PhotoImage(file=".\\images\\home.png")
Button(root,fg ='black' ,bg= 'light green',image = home_logo,command=home).grid(row= 4 ,column = 10, padx = 10)
root.mainloop()