from tkinter import *
import tkinter
from tkinter import ttk
from tkinter import messagebox
import sqlite3
import datetime
rhodes = [Link]()
[Link]('950x625')
def database1():
con = [Link]('[Link]')
cur = [Link]()
[Link]('create table if not exists cardetails'
'(owner_name TEXT,ID_num INTEGER,phone_number INTEGER,car_type
TEXT,reg_num TEXT'
',check_in TEXT,date TEXT,payment TEXT,slot_number INTEGER,id INTEGER
PRIMARY KEY AUTOINCREMENT NOT NULL)')
[Link]()
[Link]()
database1()
def back(frame, above_frame):
[Link](frame, text="BACK", command=lambda: above_frame.tkraise()).place(x=310,
y=600)
def go():
a = [Link]()
if int(a) == 1234:
main_menu.tkraise()
[Link]("Login successfull", 'The system has successfully logged
in')
else:
[Link]('Incorrect password', 'Invalid password')
slots = Frame(rhodes, width=1300, height=800)
[Link](row=0, column=0, sticky="news")
login = Frame(rhodes, width=950, height=800)
[Link](row=0, column=0, sticky="news")
new_entry = Frame(rhodes, width=950, height=800)
new_entry.grid(row=0, column=0, sticky="news")
car_details = Frame(rhodes, width=950, height=800)
car_details.grid(row=0, column=0, sticky="news")
main_menu = Frame(rhodes, width=950, height=800)
main_menu.grid(row=0, column=0, sticky="news")
def ho():
[Link]()
ya = 20
xa = 80
y1 = 20
x2 = 80
conn = [Link]("[Link]")
cur = [Link]()
# [Link]("insert into dir(stat) values(1)")
# [Link]("drop table `borrowers`")
[Link]("SELECT * FROM cardetails")
rows = [Link]()
row = [Link]()
arr = []
for k in row:
[Link](k[8])
n = len(arr)
print(arr)
for i in range(1, 30):
cl = ""
if i == int(arr[1]):
cl = "red"
else:
cl = "green"
[Link](slots, text=i, bg=cl, height=2, width=3).place(y=ya, x=xa)
ya += 0
xa += 40
if xa >= 600:
ya = 100
xa = 80
# ho()
def hello():
[Link]()
ya = 20
xa = 80
y1 = 20
x2 = 80
conn = [Link]("[Link]")
cur = [Link]()
# [Link]("insert into dir(stat) values(1)")
# [Link]("drop table `borrowers`")
[Link]("SELECT * FROM cardetails")
rows = [Link]()
####
for i in range(1, 30):
cl = ""
if i == int(rows[8]):
cl = "red"
else:
cl = "green"
[Link](slots, text=i, bg=cl, height=2, width=3).place(y=ya, x=xa)
ya += 0
xa += 40
if xa >= 600:
ya = 100
xa = 80
####
# for row in rows:
# a = row[8]
# [Link](slots, text=a,bg="red", height=2, width=3).place(y=y1, x=x2)
# y1 += 0
# x2 += 40
# if x2 >= 600:
# y1 = 100
# x2 = 80
[Link]()
[Link]()
Button(main_menu, bg="green", text="New Entry", width=15, height=3, relief=FLAT,
command=lambda: new_entry.tkraise()).place(x=100, y=80)
Button(main_menu, bg="green", text="FreeSlots", width=15, height=3, relief=FLAT,
command=ho).place(x=250, y=80)
Button(main_menu, bg="green", text="EXIT", width=30, height=6, relief=FLAT,
command=[Link]).place(x=200, y=250)
Button(main_menu, bg="blue", text="Log out", width=15, height=3, relief=FLAT,
command=lambda: [Link]()).place(
x=0, y=450)
Message(login, text="Username:", width=100).place(x=200, y=80)
un = [Link](login)
[Link](x=290, y=80)
Message(login, text="Password:", width=100).place(x=200, y=120)
en = [Link](login, show='*')
[Link](x=290, y=120)
[Link](login, text="Enter", command=go).place(x=310, y=200)
V1 = IntVar()
def check_in():
con = [Link]('[Link]')
cur = [Link]()
car = ''
pay = ''
if [Link]() == 1:
car = 'Truck'
elif [Link]() == 2:
car = 'Van'
elif [Link]() == 3:
car = 'Lorry'
if [Link]() == 1:
pay = 'cash'
elif [Link]() == 2:
pay = 'swipe'
elif [Link]() == 3:
pay = 'ECO_cash'
a = [Link]()
tym = [Link](a, "%H : %M")
d = [Link]()
dyt = [Link](d, '%d-%m-%Y')
[Link](
'insert into `cardetails`(owner_name, ID_num ,phone_number ,car_type,'
'reg_num ,check_in, date ,payment ,slot_number ) values(?,?,?,?,?,?,?,?,?)',
([Link](), [Link](), [Link](), car, [Link](), tym, dyt, pay, [Link]()))
[Link]()
[Link]()
[Link](0, '')
[Link](0, '')
[Link](0, '')
[Link](0, '')
[Link](0, '')
[Link](0)
[Link](0)
Message(new_entry, text='OWNERS DETAILS', font=("comic sans ms", 15),
width=300).place(x=100, y=40)
Label(new_entry, text='OWNERS NAME').place(x=100, y=80)
nam = [Link](new_entry)
Label(new_entry, text='ID NUMBER').place(x=400, y=80)
Label(new_entry, text='PHONE NUMBER').place(x=100, y=130)
Pn = [Link](new_entry)
[Link](x=200, y=130)
ID = [Link](new_entry)
[Link](x=500, y=80)
[Link](x=200, y=80)
Message(new_entry, text='CAR DETAILS', font=("comic sans ms", 15),
width=300).place(x=100, y=160)
Label(new_entry, text='CAR TYPE').place(x=100, y=220)
A1 = [Link](new_entry, text='TRUCK', variable=V1, value=1).place(x=200,
y=220)
A2 = [Link](new_entry, text='VAN', variable=V1, value=2).place(x=300, y=220)
A3 = [Link](new_entry, text='LORRIES', variable=V1, value=3).place(x=400,
y=220)
Label(new_entry, text='RegNUMBER').place(x=100, y=290)
Rn = [Link](new_entry)
[Link](x=200, y=290)
PT = IntVar()
Label(new_entry, text='PAYMENT TYPE').place(x=100, y=360)
B1 = [Link](new_entry, text='CASH', variable=PT, value=1).place(x=200, y=360)
B2 = [Link](new_entry, text='SWIPE', variable=PT, value=2).place(x=300,
y=360)
B3 = [Link](new_entry, text='ECO_CASH', variable=PT, value=3).place(x=400,
y=360)
Label(new_entry, text='SLOT_NUMBER').place(x=100, y=430)
Sn = [Link](new_entry)
[Link](x=200, y=430)
[Link](new_entry, text="Enter", command=check_in).place(x=310, y=500)
back(new_entry, main_menu)
def table():
tree = [Link](car_details, columns=(
"owner name", "ID number", "phone number", "car type", "RegNumber", "check in
time", "Date", "payment type",
"slot number"), height=18)
[Link](x=30, y=60)
car_details.tkraise()
[Link]('owner name', text="owner name", anchor=W)
[Link]('ID number', text="ID number", anchor=W)
[Link]('phone number', text="phone number", anchor=W)
[Link]('car type', text="car type", anchor=W)
[Link]('RegNumber', text="RegNumber", anchor=W)
[Link]('check in time', text="check in time", anchor=W)
[Link]('Date', text="Date", anchor=W)
[Link]('payment type', text='payment type', anchor=W)
[Link]('slot number', text='slot number', anchor=W)
[Link]('#0', stretch=NO, minwidth=0, width=0)
[Link]('#1', stretch=NO, minwidth=0, width=100)
[Link]('#2', stretch=NO, minwidth=0, width=100)
[Link]('#3', stretch=NO, minwidth=0, width=100)
[Link]('#4', stretch=NO, minwidth=0, width=100)
[Link]('#5', stretch=NO, minwidth=0, width=100)
[Link]('#6', stretch=NO, minwidth=0, width=100)
[Link]('#7', stretch=NO, minwidth=0, width=100)
[Link]('#8', stretch=NO, minwidth=0, width=100)
[Link]('#9', stretch=NO, minwidth=0, width=100)
con = [Link]('[Link]')
cur = [Link]()
[Link]('select * from cardetails')
row = [Link]()
for data in row:
[Link]('', [Link], values=data)
[Link]()
[Link]()
def deleta():
if not [Link]():
print("ERROR")
else:
result = [Link]('Delete record', 'Are you sure you want to
delete this record?',
icon="warning")
if result == 'yes':
curItem = [Link]()
contents = ([Link](curItem))
selecteditem = contents['values']
[Link](curItem)
conn = [Link]("[Link]")
cur = [Link]()
[Link]("DELETE FROM `cardetails` WHERE `id` = %d" %
selecteditem[9])
[Link]()
[Link]()
[Link](car_details, text="Delete", command=deleta).place(x=200, y=550)
Button(main_menu, bg="green", text="VehicleDetails", width=15, height=3, relief=FLAT,
command=table).place(x=400, y=80)
back(car_details, main_menu)
[Link]('Car Park Management')
[Link]()