Car Booking System in Python with Source Code
The Car Booking System in Python is developed in python programming language and it is a desktop application. This system is created using tkinter and graphical user interface. The Car Booking System has sqlite3 database and free to download the open source code.
This Car Booking System has a task record contains python content file (car_booking.py, car_appointment, car_display). The gameplay interaction Graphics is sufficient and the controls are excessively basic for the clients.So as to book an arrangement, the client needs to enter the proprietor’s name, age, sex, area, section time and telephone number.
To see all the accessible arrangement information, the client simply needs to tap on the NextBooking button on the Display module. Remaining component is tied in with refreshing and erasing records. Essentially by entering proprietor’s name, the client can alter and refresh the information. The plan is easy to the point that the client won’t discover any challenges while dealing with it.
Anyway if you want level up your knowledge in programming especially games in python, try this new article I’ve made for you Code For Game in Python: Python Game Projects With Source Code
Before you start creating this Car Booking System in Python, make sure that you have PyCharm IDE and SQLite3 installed in your computer.
Steps on how to create Car Booking System in Python
Car Booking System in Python with Source Code
- Step 1: Create a project name.
First when you finished installed the Pycharm IDE in your computer, open it and then create a “project name” after creating a project name click the “create” button.
- Step 2: Create a python file.
Second after creating a project name, “right click” your project name and then click “new” after that click the “python file“.
- Step 3: Name your python file.
Third after creating a python file, Name your python file after that click “enter“.
- Step 4: The actual code.
This is the actual coding on how to create Car Booking System in Python, and you are free to copy this code and download the full source code given below.
Importing Tkinter Module
In the code given below, which is for the function for importing tkinter. Tkinter is the standard GUI library for Python. Python when combined with Tkinter provides a fast and easy way to create GUI applications.
from tkinter import *
Importing the Sqlite3 Module
In the code given below, which is for the function for importing SQLite3 . SQLite is a C library that provides a lightweight disk-based database that doesn’t require a separate server process and allows accessing the database using a nonstandard variant of the SQL query language.
import sqlite3
This module is for the appointment
In the code given below, which is for the function for appointment. Likewise, you can see the frames in the windows, the labels, the button use to perform command , entries for all the labels, and the function to call when the submit button is clicked. Getting the value of user inputs, checking if the user input is empty and you can see the displaying the logs on the right frame.
# import modules from tkinter import * import sqlite3 import tkinter.messagebox conn = sqlite3.connect('carbooking.db') c = conn.cursor() ids = [] class Application: def __init__(self, windows): self.windows = windows self.left = Frame(windows, width=800, height=720, bg='navajo white') self.left.pack(side=LEFT) self.right = Frame(windows, width=600, height=720, bg='navajo white') self.right.pack(side=RIGHT) self.title = Label(self.left, text="Car Booking", font=( 'georgia 40 bold'), fg='black', bg='navajo white') self.title.place(x=0, y=0) self.n = Label(self.left, text="Owner's Name", font=( 'georgia 18 bold'), fg='black', bg='navajo white') self.n.place(x=0, y=100) self.a = Label(self.left, text="Age", font=( 'georgia 18 bold'), fg='black', bg='navajo white') self.a.place(x=0, y=140) self.gen = Label(self.left, text="Gender", font=( 'georgia 18 bold'), fg='black', bg='navajo white') self.gen.place(x=0, y=180) self.loc = Label(self.left, text="Location", font=( 'georgia 18 bold'), fg='black', bg='navajo white') self.loc.place(x=0, y=220) self.t = Label(self.left, text="Entry Time", font=( 'georgia 18 bold'), fg='black', bg='navajo white') self.t.place(x=0, y=260) self.phoneNumber = Label(self.left, text="Phone Number", font=( 'georgia 18 bold'), fg='black', bg='navajo white') self.phoneNumber.place(x=0, y=300) self.nametextentry = Entry(self.left, width=30) self.nametextentry.place(x=250, y=100) self.agetextentry = Entry(self.left, width=30) self.agetextentry.place(x=250, y=140) self.gendertextentry = Entry(self.left, width=30) self.gendertextentry.place(x=250, y=180) self.locationtextentry = Entry(self.left, width=30) self.locationtextentry.place(x=250, y=220) self.timetextentry = Entry(self.left, width=30) self.timetextentry.place(x=250, y=260) self.phonetextentry = Entry(self.left, width=30) self.phonetextentry.place(x=250, y=300) self.submit = Button(self.left, text="Add Booking", width=20, height=2, bg='white', command=self.add_appointment) self.submit.place(x=300, y=340) sql2 = "SELECT ID FROM appointments " self.result = c.execute(sql2) for self.row in self.result: self.id = self.row[0] ids.append(self.id) self.new = sorted(ids) self.final_id = self.new[len(ids)-1] self.logs = Label(self.right, text="Booking logs", font=( 'georgia 28 bold'), fg='black', bg='navajo white') self.logs.place(x=70, y=10) self.box = Text(self.right, width=150, height=40) self.box.place(x=20, y=60) self.box.insert(END, "Total Bookings till now : " + str(self.final_id) + " \n") def add_appointment(self): self.value_1 = self.nametextentry.get() self.value_2 = self.agetextentry.get() self.value_3 = self.gendertextentry.get() self.value4 = self.locationtextentry.get() self.value5 = self.timetextentry.get() self.value6 = self.phonetextentry.get() if self.value_1 == '' or self.value_2 == '' or self.value_3 == '' or self.value4 == '' or self.value5 == '': tkinter.messagebox.showinfo("Warning", "Please Fill Up All Boxes") else: sql = "INSERT INTO 'appointments' (name, age, gender, location, scheduled_time, phone) VALUES(?, ?, ?, ?, ?, ?)" c.execute(sql, (self.value_1, self.value_2, self.value_3, self.value4, self.value5, self.value6)) conn.commit() tkinter.messagebox.showinfo( "Success", "Booking for " + str(self.value_1) + " has been created") self.box.insert(END, 'Booking fixed for ' + str(self.value_1) + ' at ' + str(self.value5)) root = Tk() b = Application(root) root.geometry("1366x768") root.resizable(False, False) root.mainloop()
This module is for the booking
In the code given below, which is for the function for car booking. Also you can see the title, label, text entry, search button, delete button, creating the update form, declaring the variables to update and the delete function for the appointment.
from tkinter import * import tkinter.messagebox import sqlite3 conn = sqlite3.connect('carbooking.db') c = conn.cursor() class Application: def __init__(self, windows): self.windows = windows self.title = Label(windows, text="Bookings ", fg='black', font=('arial 40 bold')) self.title.place(x=150, y=20) self.n = Label(windows, text="Enter Owner's Name", font=('arial 18 bold')) self.n.place(x=0, y=100) self.nametextentry = Entry(windows, width=30) self.nametextentry.place(x=280, y=92) self.find = Button(windows, text="Search", width=12, height=1, bg='navajo white', command=self.search) self.find.place(x=350, y=132) def search(self): self.input = self.nametextentry.get() sql = "SELECT * FROM appointments WHERE name LIKE ?" self.res = c.execute(sql, (self.input,)) for self.row in self.res: self.n1 = self.row[1] self.a = self.row[2] self.gen = self.row[3] self.loc = self.row[4] self.t = self.row[6] self.phoneNumber = self.row[5] self.name_update = Label(self.windows, text="Owner's Name", font=('arial 18 bold')) self.name_update.place(x=0, y=160) self.age_update = Label(self.windows, text="Age", font=('arial 18 bold')) self.age_update.place(x=0, y=200) self.gender_update = Label(self.windows, text="Gender", font=('arial 18 bold')) self.gender_update.place(x=0, y=240) self.location_update = Label(self.windows, text="Location", font=('arial 18 bold')) self.location_update.place(x=0, y=280) self.time_update = Label(self.windows, text="Entry Time", font=('arial 18 bold')) self.time_update.place(x=0, y=320) self.phoneNumber_update = Label(self.windows, text="Phone Number", font=('arial 18 bold')) self.phoneNumber_update.place(x=0, y=360) self.textEntry1 = Entry(self.windows, width=30) self.textEntry1.place(x=300, y=170) self.textEntry1.insert(END, str(self.n1)) self.textEntry2 = Entry(self.windows, width=30) self.textEntry2.place(x=300, y=210) self.textEntry2.insert(END, str(self.a)) self.textEntry3 = Entry(self.windows, width=30) self.textEntry3.place(x=300, y=250) self.textEntry3.insert(END, str(self.gen)) self.textEntry4 = Entry(self.windows, width=30) self.textEntry4.place(x=300, y=290) self.textEntry4.insert(END, str(self.loc)) self.textEntry5 = Entry(self.windows, width=30) self.textEntry5.place(x=300, y=330) self.textEntry5.insert(END, str(self.t)) self.textEntry6 = Entry(self.windows, width=30) self.textEntry6.place(x=300, y=370) self.textEntry6.insert(END, str(self.phoneNumber)) self.edit = Button(self.windows, text="Update?", width=20, height=2, fg='white', bg='black', command=self.update) self.edit.place(x=400, y=410) self.dlte = Button(self.windows, text="Delete?", width=20, height=2, fg='white', bg='black', command=self.delete) self.dlte.place(x=150, y=410) def update(self): self.variable1 = self.textEntry1.get() #updated name self.variable2 = self.textEntry2.get() #updated age self.variable3 = self.textEntry3.get() #updated gender self.variable4 = self.textEntry4.get() #updated location self.variable5 = self.textEntry5.get() #updated phone self.variable6 = self.textEntry6.get() #updated time query = "UPDATE appointments SET name=?, age=?, gender=?, location=?, phone=?, scheduled_time=? WHERE name LIKE ?" c.execute(query, (self.variable1, self.variable2, self.variable3, self.variable4, self.variable5, self.variable6, self.nametextentry.get(),)) conn.commit() tkinter.messagebox.showinfo("Updated", "Successfully Updated.") def delete(self): sql2 = "DELETE FROM appointments WHERE name LIKE ?" c.execute(sql2, (self.nametextentry.get(),)) conn.commit() tkinter.messagebox.showinfo("Success", "Deleted Successfully") self.textEntry1.destroy() self.textEntry2.destroy() self.textEntry3.destroy() self.textEntry4.destroy() self.textEntry5.destroy() self.textEntry6.destroy() # creating the object root = Tk() b = Application(root) root.geometry("1366x768+0+0") root.resizable(False, False) root.mainloop()
This module is for the display bookings
In the code given below, which is for the function for display bookings. You can see the title, a button to replace or change the bookings and the function to speak the text and update the text and the connection to database use in the system.
from tkinter import * import sqlite3 import pyttsx3 # connection to database conn = sqlite3.connect('carbooking.db') c = conn.cursor() no = [] clients = [] sql = "SELECT * FROM appointments" res = c.execute(sql) for r in res: ids = r[0] name = r[1] no.append(ids) clients.append(name) class Application: def __init__(self, windows): self.windows = windows self.x = 0 # title self.title = Label(windows, text="Bookings", font=('arial 60 bold'), fg='green') self.title.place(x=350, y=0) self.replace = Button(windows, text="Next Booking", width=25, height=2, bg='steelblue', command=self.function) self.replace.place(x=500, y=600) self.none = Label(windows, text="", font=('arial 200 bold')) self.none.place(x=500, y=100) self.clients_name = Label(windows, text="", font=('arial 80 bold')) self.clients_name.place(x=300, y=400) def function(self): self.none.config(text=str(no[self.x])) self.clients_name.config(text=str(clients[self.x])) voice = pyttsx3.init() voices = voice.getProperty('voices') rate = voice.getProperty('rate') voice.setProperty('rate', rate-50) voice.say('Booking number ' + str(no[self.x]) + str(clients[self.x])) voice.runAndWait() self.x += 1 root = Tk() b = Application(root) root.geometry("1366x768+0+0") root.resizable(False, False) root.mainloop()
Downloadable Source Code Below
I have here the list of Best Python Project with Source code free to download for free, I hope this can help you a lot.
Summary
That’s how you create Car Booking System in Python in your projects. You can always expand and try different ways in implementing the Car Booking System in Python in your Python projects.
In this Car Booking System in Python is free to download. Car Booking System in Python contains the admin side. This project is good for the student who want to learn python programming because this project contains a Graphical User Interface (GUI) and a users friendly. It is easy to understand and manipulate this project and use for education purpose only.
Related Articles
- Loan Calculator in Python with Source Code
- Python Code For Food Ordering System
- College Management System in Python with Source Code
- Ticket Booking System In Python With Source Code
- Snakes and Ladders Game in Python with Source Code
- Code For Game in Python: Python Game Projects With Source Code
- Stickman Game in Python with Source Code
- Tank Game Python with Source Code
- Tetris In Python Code
- Mario Game In Python With Source Code
- Hangman Game In Python With Source Code
- Aircraft War Game in Python with Source Code
- Snake Game In Python Code
- How to Make Bouncing Ball Game in Python with Source Code
- How to Create Rock-Paper-Scissor Game in Python
Inquiries
If you have any questions or suggestions about Car Booking System in Python with Source Code , please feel free to leave a comment below.
only car booking is working for me. can you guess the error for me?