-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnew_run_10.py
93 lines (63 loc) · 2.75 KB
/
new_run_10.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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
from tkinter import *
import sqlite3
from tkinter import messagebox
root = Tk()
root.title('New run')
def add_run():
con=sqlite3.connect('bus_database.db')
c=con.cursor()
ID=route_ent.get()
Date=station_ent.get()
Seat=id_ent.get()
if len(id_ent.get())==0 or len(name_ent.get())==0 or len(address_ent.get())==0 or len(phone_ent.get())==0 or len(email_ent.get())==0:
messagebox.showerror('Value Missing','Please enter all details')
else:
c.execute('''insert into running_details(running_bus_id,running_date,a_seat) values (?,?,?)''',(ID,Date,Seat))
con.commit()
con.close()
messagebox.showinfo("Message", "Record Added Successfully")
def delete_run():
con=sqlite3.connect('bus_database.db')
c=con.cursor()
ID=route_ent.get()
Date=station_ent.get()
c.execute(''' delete from running_details where running_bus_id=? and running_date=?''',(ID,Date))
con.commit()
con.close()
messagebox.showinfo("Delete", "Record Deleted Successfully")
h,w = root.winfo_screenheight(), root.winfo_screenwidth()
root.geometry('%dx%d+0+0'%(w,h))
bus = PhotoImage(file = ".\\Bus_for_project.png")
Label(root, image = bus).grid(row = 0, column = 0, columnspan = 10, padx = w//3, pady=10)
title = Label(root, text = "ONLINE BUS BOOKING SYSTEM" , fg = 'red' , bg = 'skyblue', font = 'Arial 20 bold')
title.grid(row = 2, column = 0, columnspan = 10)
title = Label(root, text = "Add Bus Running Details" , fg = 'green' , font = 'Arial 18 bold')
title.grid(row = 6, column = 0, columnspan = 10, pady=20)
route_text = Label(root, text = "Bus Id", font="Arial 11")
route_text.grid(row=10, column=0)
route_ent = Entry(root)
route_ent.grid(row=10, column=1)
station_text = Label(root, text = "Running Date", font="Arial 11")
station_text.grid(row=10, column=2)
station_ent = Entry(root)
station_ent.grid(row=10, column=3)
id_text = Label(root, text = "Seat Available", font="Arial 11")
id_text.grid(row=10, column=4)
id_ent = Entry(root)
id_ent.grid(row=10, column=5)
add_but = Button(root, text = "Add Run", font="Arial 11", bg ="lightgreen",command=add_run)
add_but.grid(row = 10, column = 6, pady=10)
edit_but = Button(root, text = "Delete Run", font="Arial 11", bg = "lightgreen", command=delete_run)
edit_but.grid(row = 10, column = 7, pady=10)
house = PhotoImage(file = ".\\home.png")
def home():
root.destroy()
import home_2
house_but = Button(root, image=house, bg = "lightgreen", command=home)
house_but.grid(row = 12, column = 6, pady=10)
def back():
root.destroy()
import new_details_6
back_but = Button(root, text='Go Back', command=back)
back_but.grid(row = 12, column = 7, pady=10)
root.mainloop()