Flight Management System in Python with Source Code

Flight Management System in Python with Source Code

The Flight Management System in Python is created using tkinter and graphical user interface. This Flight Management System is developed in python programming language and it is a desktop application. The Flight Management System is free to download the open source code. The task record contains a python content (flight.py). This Flight Management System contains admin side only. The admin side handles all the operations, such as handling passengers, adding or upgrading flights, displaying flight data, and flight cancelation.

Talking about the features of this framework of Flight Management System, it includes only the admin portion.This is a management system that is designed to keep track of flight records, personnel, and flight information updates. The main focus of this project is on CRUD with search features. The concept is so basic that the user would not face any difficulties when operating on 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 Flight Management System in Python make sure that you have PyCharm IDE installed in your computer.

By the way if you are new to python programming and you don’t know what would be the the Python IDE to use, I have here a list of Best Python IDE for Windows, Linux, Mac OS that will suit for you. I also have here How to Download and Install Latest Version of Python on Windows.

Steps on how to create Flight Management System in Python

Time needed: 5 minutes.

Flight Management 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“.Creating Python FIle Name in Flight Management System in Python With Source Code

  • Step 3: Name your python file.

    Third after creating a python file, Name your python file after that click “enter“.Naming Python FIle Name in Flight Management System in Python With Source Code

  • Step 4: The actual code.

    This is the actual coding on how to create Flight Management 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 of tkinter module. Tkinter is the standard GUI library for Python. Python when combined with Tkinter provides a fast and easy way to create GUI applications.

import tkinter as tk

This module is for the reminder

In the code given below, which is for the function of reminder. The reminder will pop up if there’s a flight not updated or cancelled.(Flight Management System in Python)

def reminder():
time_clock = datetime.datetime.now()
for x in scheduled:
c = scheduled[x][0].split(":")
time_hrs = time_clock.replace(hour=int(c[0]), minute=int(c[1]), second=0, microsecond=0)
if time_clock > time_hrs:
scheduled_reminders = tk.Tk()
scheduled_reminders.title("Reminder!")
tk.Label(master=scheduled_reminders, text="Flight Number " + x + " Not Updated").grid(row=0, column=0)
scheduled_reminders.mainloop()

This module is for the delete users account

In the code given below, which is for the function of delete user account.(Flight Management System in Python)

def delete_users_account(): # This function is responsible for deleting users
def delete_users_back():
user = username.get()
if not (user in admin or user in manager or user in cancelled):
root = tk.Tk()
root.title("Username Not Found!")
tk.Label(master=root, text="Username not found! Please try again!").grid(row=1, column=1)

else:
if username.get() == 'admin':
a = tk.Tk()
a.title("Can't Delete user!")
tk.Label(master=a, text="Cannot Delete user!").grid(row=1, column=1)
a.mainloop()
elif user in admin:
if user != 'admin':
del admin[user]
ad = tk.Tk()
ad.title("Success!")
tk.Label(master=ad, text="Admin User Successfully Deleted!").grid(row=1, column=1)

elif user in manager:
del manager[user]
ad = tk.Tk()
ad.title("Success!")
tk.Label(master=ad, text=" Manager Successfully Deleted!").grid(row=1, column=1)
if user in standard:
del standard[user]
ad = tk.Tk()
ad.title("Success!")
tk.Label(master=ad, text="Standard User Successfully Deleted!").grid(row=1, column=1)

users_delete_acc = tk.Tk()
users_delete_acc.title("Delete A User")
tk.Label(master=users_delete_acc, text="Enter the Username").grid(row=1, column=0)
username = tk.Entry(master=users_delete_acc)
username.grid(row=1, column=1)
admin2 = tk.Button(master=users_delete_acc, text="Confirm Deletion", width=25, command=delete_users_back).grid(
row=1, column=2)

This module is for the adding admin users

In the code given below, which is for the function of adding admin users.(Flight Management System in Python)

def user_management(): # this function is responsible for adding users
def adding_user():
def adding_admin():
def admin_username():
def admin_username_back():
password = passwrd.get()
admin[user] = password
root = tk.Tk()
root.title("Success")
tk.Label(master=root, text="Admin Successfully Added!").grid(row=1, column=1)

user = username.get()
if user in admin or user in manager or user in standard:
root = tk.Tk()
root.title("Username Already Exists!")
tk.Label(master=root, text="Username Already Exists! Please Try Again").grid(row=1, column=1)
manage_user_scheduled.destroy()
system.destroy()
else:
tk.Label(master=system, text="Enter the Password").grid(row=2, column=0)
passwrd = tk.Entry(master=system, show='*')
passwrd.grid(row=2, column=1)
tk.Button(master=system, text="Confirm Password", command=admin_username_back, width=25).grid(row=2,
column=3)

system = tk.Tk()
system.title("Add An Admin")
tk.Label(master=system, text="Enter the Username").grid(row=1, column=0)
username = tk.Entry(master=system)
username.grid(row=1, column=1)
admin3 = tk.Button(master=system, text="Confirm Username", width=25, command=admin_username).grid(row=1,
column=3)

This module is for the adding manager

In the code given below, which is for the function of adding manager.(Flight Management System in Python)

def add_manager():
def manager_username():
def manager_users_back():
password = passwrd.get()
manager[user] = password
root = tk.Tk()
root.title("Success")
tk.Label(master=root, text="Manager Successfully Added!").grid(row=1, column=1)

user = username.get()
if user in admin3 or user in manager or user in standard:
root = tk.Tk()
root.title("Username Already Exists!")
tk.Label(master=root, text="Username Already Exists! Please Try Again").grid(row=1, column=1)
manage_user_scheduled.destroy()
system.destroy()
else:
tk.Label(master=system, text="Enter the Password").grid(row=2, column=0)
passwrd = tk.Entry(master=system, show='*')
passwrd.grid(row=2, column=1)
tk.Button(master=system, text="Confirm Password", command=manager_users_back, width=25).grid(row=2,
column=3)

system = tk.Tk()
system.title("Add A Manager")
tk.Label(master=system, text="Enter the Username").grid(row=1, column=0)
username = tk.Entry(master=system)
username.grid(row=1, column=1)
admin3 = tk.Button(master=system, text="Confirm Username", width=25, command=manager_username).grid(row=1,

This module is for the adding standard user

In the code given below. which is for the function adding standard user.(Flight Management System in Python)

def adding_standard():
def standard_username():
def standard_back_users():
password = passwrd.get()
standard[user] = password
root = tk.Tk()
root.title("Success")
tk.Label(master=root, text="Standard User Successfully Added!").grid(row=1, column=1)

user = username.get()
if user in admin or user in manager or user in standard:
root = tk.Tk()
root.title("Username Already Exists!")
tk.Label(master=root, text="Username Already Exists! Please Try Again").grid(row=1, column=1)

system.destroy()
else:
tk.Label(master=system, text="Enter the Password").grid(row=2, column=0)
passwrd = tk.Entry(master=system, show='*')
passwrd.grid(row=2, column=1)
tk.Button(master=system, text="Confirm Password", command=standard_back_users, width=25).grid(row=2,
column=3)

system = tk.Tk()
system.title("Add A Standard User")
tk.Label(master=system, text="Enter the Username").grid(row=1, column=0)
username = tk.Entry(master=system)
username.grid(row=1, column=1)
admin3 = tk.Button(master=system, text="Confirm Username", width=25, command=standard_username).grid(row=1,
column=3)

adding_users_scheduled = tk.Tk()
adding_users_scheduled.title("Add A User")
tk.Button(master=adding_users_scheduled, width=25, text="Add An Admin", command=adding_admin).grid(row=1,
column=1)
tk.Button(master=adding_users_scheduled, width=25, text="Add A Supervisor", command=add_manager).grid(row=2,
column=1)
tk.Button(master=adding_users_scheduled, width=25, text="Add A Standard User", command=adding_standard).grid(
row=3, column=1)

This module is for the view of all users

In the code given below, which is for the function of view of all users.(Flight Management System in Python)

def display_users():
display_scheduled = tk.Tk()
display_scheduled.title("View Users")
tk.Label(master=display_scheduled, text="Admin Are:").grid(row=0, column=0)
e = 0
for a in admin:
e += 1
tk.Label(master=display_scheduled, text=("------", a)).grid(row=e, column=0)
e += 1
tk.Label(master=display_scheduled, text="Manager Are:").grid(row=e, column=0)
for a in manager:
e += 1
tk.Label(master=display_scheduled, text=("-----", a)).grid(row=e, column=0)
e += 1
tk.Label(master=display_scheduled, text="Standard Users Are:").grid(row=e, column=0)
for a in standard:
e += 1
tk.Label(master=display_scheduled, text=("-----", a)).grid(row=e, column=0)

This module is for the delete users

In the code given below, which is for the function of delete users such as admin, manager, and standard account.

def deleting_users():
def deleting_back_user():
user = username.get()
if not (user in admin or user in manager or user in standard):
root = tk.Tk()
root.title("Username Not Found!")
tk.Label(master=root, text="Username not found! Please try again!").grid(row=1, column=1)
else:
if user in admin:
del admin[user]
admin1 = tk.Tk()
admin1.title("Success!")
tk.Label(master=admin1, text="Admin User Successfully Deleted!").grid(row=1, column=1)
delete_users_scheduled.destroy()
elif user in manager:
del manager[user]
admin1 = tk.Tk()
admin1.title("Success!")
tk.Label(master=admin1, text=" Manager Successfully Deleted!").grid(row=1, column=1)
delete_users_scheduled.destroy()
if user in standard:
del standard[user]
admin1 = tk.Tk()
admin1.title("Success!")
tk.Label(master=admin1, text="Standard User Successfully Deleted!").grid(row=1, column=1)
delete_users_scheduled.destroy()

delete_users_scheduled = tk.Tk()
delete_users_scheduled.title("Delete A User")
tk.Label(master=delete_users_scheduled, text="Enter the Username").grid(row=1, column=0)
username = tk.Entry(master=delete_users_scheduled)
username.grid(row=1, column=1)
admin2 = tk.Button(master=delete_users_scheduled, text="Confirm Deletion", width=25,
command=deleting_back_user).grid(row=1, column=2)

This module is for the update

In the code given below, which is for the function of update in the destination, status, and flight number.

def update():
scheduled_update = tk.Tk()
scheduled_update.title("Update/Add A Flight")
tk.Label(master=scheduled_update, text="Enter The Flight Number").grid(row=1, column=0)
number_of_flight = tk.Entry(master=scheduled_update)
number_of_flight.grid(row=1, column=1)

def update_btn1():
if number_of_flight.get() not in scheduled:
scheduled[number_of_flight.get()] = ["", "", ""]
tk.Label(master=scheduled_update, text="Enter Departure Time").grid(row=3, column=0)
departure_time = tk.Entry(master=scheduled_update)
departure_time.grid(row=3, column=1)
tk.Label(master=scheduled_update, text="Enter Status").grid(row=4, column=0)
stat = tk.Entry(master=scheduled_update)
stat.grid(row=4, column=1)
tk.Label(master=scheduled_update, text="Enter Destination").grid(row=5, column=0)
destination_place = tk.Entry(master=scheduled_update)
destination_place.grid(row=5, column=1)

def update_btn2():
if departure_time.get() != "":
scheduled[number_of_flight.get()][0] = departure_time.get()
if stat.get() != "":
scheduled[number_of_flight.get()][2] = stat.get()
if destination_place.get() != "":
scheduled[number_of_flight.get()][1] = destination_place.get()
update_root = tk.Tk()
update_root.title("Successfully Updated!")
tk.Label(master=update_root, text="Successfully Updated!!").grid(row=0, column=0)
scheduled_update.destroy()

tk.Button(master=scheduled_update, text="Confirm", command=update_btn2).grid(row=6, column=1)

tk.Button(master=scheduled_update, text="Confirm", command=update_btn1).grid(row=2, column=1)
scheduled_update.mainloop()

This module is for the cancel of flights

In the code given below, which is for the function for cancel of flights.

 def cancel(): # this function cancels flights
def back_cancelled():
flight = flight_number.get()
cancelled_scheduled.destroy()
if flight in cancelled:
root = tk.Tk()
root.title("Already Cancelled!")
tk.Label(master=root, text="Flight Already Cancelled. Please try again!").grid(row=1, column=1)
cancel()
elif not (flight in scheduled):
root = tk.Tk()
root.title("Flight Not Found!")
tk.Label(master=root, text="Flight Not Found. Please try again!").grid(row=1, column=1)
cancel()
else:
flight1 = scheduled.pop(flight)
del flight1[2]
flight1.append("Cancelled")
cancelled[flight] = flight1
root = tk.Tk()
root.title("Success!")
tk.Label(master=root, text="Flight Successfully Cancelled!").grid(row=1, column=1)

cancelled_scheduled = tk.Tk()
cancelled_scheduled.title("Cancel a Flight")
tk.Label(master=cancelled_scheduled, text="Enter the flight number").grid(row=1, column=0)
flight_number = tk.Entry(master=cancelled_scheduled)
flight_number.grid(row=1, column=1)
admin7 = tk.Button(master=cancelled_scheduled, width=25, text="Confirm", command=back_cancelled).grid(row=2,
column=1)

This module is for the admin control panel

In the code given below, which is for the function of admin control panel, which is you can see the view details of flights, switch user, cancel a flight, manage users, exit the program, update or add a flight.

def admin_main_features(): # admin control panel
def switch_users_admin():
admin_main_scheduled.destroy()
login()

admin_main_scheduled = tk.Tk()
admin_main_scheduled.title("Admin Control Panel")
tk.Button(master=admin_main_scheduled, text="View The Details Of Flights", command=viewing_flights).grid(row=1,
column=1)
tk.Button(master=admin_main_scheduled, text="Switch User", command=switch_users_admin).grid(row=2, column=1)
tk.Button(master=admin_main_scheduled, text="Cancel A Flight", command=cancel).grid(row=4, column=1)
tk.Button(master=admin_main_scheduled, text="Manage Users", command=user_management).grid(row=5, column=1)
tk.Button(master=admin_main_scheduled, text="Exit The Program", command=exit).grid(row=6, column=1)
tk.Button(master=admin_main_scheduled, text="Update/Add A Flight", command=update).grid(row=3, column=1)

This module is for the view of all flights

In the code given below, which is for the function for view of all flights.

def viewing_flights(): # viewing flights
can = 0
ret = 1
display = tk.Tk()
display.title("View Details Of Flights")
tk.Label(master=display, text="Flight Number--------ETA--------Destination-------Status").grid(row=1, column=0)
for i in scheduled:
can += 1
ret += 1
tk.Label(master=display,
text=(i, "-------", scheduled[i][0], "--------", scheduled[i][1], "--------", scheduled[i][2])).grid(
row=ret, column=0)
for i in cancelled:
can += 1
ret += 1
tk.Label(master=display,
text=(i, "-------", cancelled[i][0], "--------", cancelled[i][1], "--------", cancelled[i][2])).grid(
row=ret, column=0)

This module is for the login

In the code given below, which is for the function for login use in the system.

def login(): # login function
def user_verification():
def password_verification():
pas = password.get()
if check == 1:
if admin[a] == pas:
login_sched.destroy()
admin_main_features()
reminder()
else:
admin3 = tk.Tk()
admin3.title("Wrong Password!")
tk.Label(master=admin3, text="Wrong Password! Please Try Again!").grid(row=1, column=1)

elif check == 2:
if manager[a] == pas:
login_sched.destroy()
manager_main()
reminder()
else:
admin3 = tk.Tk()
admin3.title("Wrong Password!")
tk.Label(master=admin3, text="Wrong Password! Please Try Again!").grid(row=1, column=1)
elif check == 3:
if standard[a] == pas:
login_sched.destroy()
main_standard()

else:
admin3 = tk.Tk()
admin3.title("Wrong Password!")
tk.Label(master=admin3, text="Wrong Password! Please Try Again!").grid(row=1, column=1)

a = username.get()

if not (a in admin or a in manager or a in standard):
admin1 = tk.Tk()
admin1.title("Wrong Username!")
tk.Label(master=admin1, text="Username Not Found. Please Try Again!").grid(row=1, column=1)
else:
if a in manager:
check = 2
elif a in admin:
check = 1
elif a in standard:
check = 3

tk.Label(master=login_sched, text="Enter Your Password").grid(row=2, column=0)
password = tk.Entry(master=login_sched, show='*')
password.grid(row=2, column=1)
admin3 = tk.Button(master=login_sched, text="Confirm Password", width=25,
command=password_verification).grid(row=2, column=2)

Complete Source Code of Flight Management System





import tkinter as tk
import datetime

admin = {'admin': 'admin'}
manager = {'manager': 'manager'}
standard = {'standard': 'standard'}
scheduled = {'AGENTX44': ["10:10", 'Manila', "Delayed"], 'ADO2354': ['5:30', 'Cebu City', 'Delayed'],
'ASIA1231': ['1:49', 'Boracay', 'Scheduled'], 'AGENT221': ['7:40', 'Cagayan De Oro', 'Scheduled'],
'ASIAPACIFIC': ['2:50', 'Albay', 'Delayed'], 'AB3452': ['9:320', 'Laguna', 'Scheduled'],
'LA3452': ['8:40', 'Dumaguete City', 'Scheduled']}
cancelled = {'ASIA3456': ["3:00", "Marawi City", "Cancelled"]}


def reminder():
time_clock = datetime.datetime.now()
for x in scheduled:
c = scheduled[x][0].split(":")
time_hrs = time_clock.replace(hour=int(c[0]), minute=int(c[1]), second=0, microsecond=0)
if time_clock > time_hrs:
scheduled_reminders = tk.Tk()
scheduled_reminders.title("Reminder!")
tk.Label(master=scheduled_reminders, text="Flight Number " + x + " Not Updated").grid(row=0, column=0)
scheduled_reminders.mainloop()


def delete_users_account(): # This function is responsible for deleting users
def delete_users_back():
user = username.get()
if not (user in admin or user in manager or user in cancelled):
root = tk.Tk()
root.title("Username Not Found!")
tk.Label(master=root, text="Username not found! Please try again!").grid(row=1, column=1)

else:
if username.get() == 'admin':
a = tk.Tk()
a.title("Can't Delete user!")
tk.Label(master=a, text="Cannot Delete user!").grid(row=1, column=1)
a.mainloop()
elif user in admin:
if user != 'admin':
del admin[user]
ad = tk.Tk()
ad.title("Success!")
tk.Label(master=ad, text="Admin User Successfully Deleted!").grid(row=1, column=1)

elif user in manager:
del manager[user]
ad = tk.Tk()
ad.title("Success!")
tk.Label(master=ad, text=" Manager Successfully Deleted!").grid(row=1, column=1)
if user in standard:
del standard[user]
ad = tk.Tk()
ad.title("Success!")
tk.Label(master=ad, text="Standard User Successfully Deleted!").grid(row=1, column=1)

users_delete_acc = tk.Tk()
users_delete_acc.title("Delete A User")
tk.Label(master=users_delete_acc, text="Enter the Username").grid(row=1, column=0)
username = tk.Entry(master=users_delete_acc)
username.grid(row=1, column=1)
admin2 = tk.Button(master=users_delete_acc, text="Confirm Deletion", width=25, command=delete_users_back).grid(
row=1, column=2)


def user_management(): # this function is responsible for adding users
def adding_user():
def adding_admin():
def admin_username():
def admin_username_back():
password = passwrd.get()
admin[user] = password
root = tk.Tk()
root.title("Success")
tk.Label(master=root, text="Admin Successfully Added!").grid(row=1, column=1)

user = username.get()
if user in admin or user in manager or user in standard:
root = tk.Tk()
root.title("Username Already Exists!")
tk.Label(master=root, text="Username Already Exists! Please Try Again").grid(row=1, column=1)
manage_user_scheduled.destroy()
system.destroy()
else:
tk.Label(master=system, text="Enter the Password").grid(row=2, column=0)
passwrd = tk.Entry(master=system, show='*')
passwrd.grid(row=2, column=1)
tk.Button(master=system, text="Confirm Password", command=admin_username_back, width=25).grid(row=2,
column=3)

system = tk.Tk()
system.title("Add An Admin")
tk.Label(master=system, text="Enter the Username").grid(row=1, column=0)
username = tk.Entry(master=system)
username.grid(row=1, column=1)
admin3 = tk.Button(master=system, text="Confirm Username", width=25, command=admin_username).grid(row=1,
column=3)

def add_manager():
def manager_username():
def manager_users_back():
password = passwrd.get()
manager[user] = password
root = tk.Tk()
root.title("Success")
tk.Label(master=root, text="Manager Successfully Added!").grid(row=1, column=1)

user = username.get()
if user in admin3 or user in manager or user in standard:
root = tk.Tk()
root.title("Username Already Exists!")
tk.Label(master=root, text="Username Already Exists! Please Try Again").grid(row=1, column=1)
manage_user_scheduled.destroy()
system.destroy()
else:
tk.Label(master=system, text="Enter the Password").grid(row=2, column=0)
passwrd = tk.Entry(master=system, show='*')
passwrd.grid(row=2, column=1)
tk.Button(master=system, text="Confirm Password", command=manager_users_back, width=25).grid(row=2,
column=3)

system = tk.Tk()
system.title("Add A Manager")
tk.Label(master=system, text="Enter the Username").grid(row=1, column=0)
username = tk.Entry(master=system)
username.grid(row=1, column=1)
admin3 = tk.Button(master=system, text="Confirm Username", width=25, command=manager_username).grid(row=1,
column=3)

def adding_standard():
def standard_username():
def standard_back_users():
password = passwrd.get()
standard[user] = password
root = tk.Tk()
root.title("Success")
tk.Label(master=root, text="Standard User Successfully Added!").grid(row=1, column=1)

user = username.get()
if user in admin or user in manager or user in standard:
root = tk.Tk()
root.title("Username Already Exists!")
tk.Label(master=root, text="Username Already Exists! Please Try Again").grid(row=1, column=1)

system.destroy()
else:
tk.Label(master=system, text="Enter the Password").grid(row=2, column=0)
passwrd = tk.Entry(master=system, show='*')
passwrd.grid(row=2, column=1)
tk.Button(master=system, text="Confirm Password", command=standard_back_users, width=25).grid(row=2,
column=3)

system = tk.Tk()
system.title("Add A Standard User")
tk.Label(master=system, text="Enter the Username").grid(row=1, column=0)
username = tk.Entry(master=system)
username.grid(row=1, column=1)
admin3 = tk.Button(master=system, text="Confirm Username", width=25, command=standard_username).grid(row=1,
column=3)

adding_users_scheduled = tk.Tk()
adding_users_scheduled.title("Add A User")
tk.Button(master=adding_users_scheduled, width=25, text="Add An Admin", command=adding_admin).grid(row=1,
column=1)
tk.Button(master=adding_users_scheduled, width=25, text="Add A Supervisor", command=add_manager).grid(row=2,
column=1)
tk.Button(master=adding_users_scheduled, width=25, text="Add A Standard User", command=adding_standard).grid(
row=3, column=1)

def display_users():
display_scheduled = tk.Tk()
display_scheduled.title("View Users")
tk.Label(master=display_scheduled, text="Admin Are:").grid(row=0, column=0)
e = 0
for a in admin:
e += 1
tk.Label(master=display_scheduled, text=("------", a)).grid(row=e, column=0)
e += 1
tk.Label(master=display_scheduled, text="Manager Are:").grid(row=e, column=0)
for a in manager:
e += 1
tk.Label(master=display_scheduled, text=("-----", a)).grid(row=e, column=0)
e += 1
tk.Label(master=display_scheduled, text="Standard Users Are:").grid(row=e, column=0)
for a in standard:
e += 1
tk.Label(master=display_scheduled, text=("-----", a)).grid(row=e, column=0)

def deleting_users():
def deleting_back_user():
user = username.get()
if not (user in admin or user in manager or user in standard):
root = tk.Tk()
root.title("Username Not Found!")
tk.Label(master=root, text="Username not found! Please try again!").grid(row=1, column=1)
else:
if user in admin:
del admin[user]
admin1 = tk.Tk()
admin1.title("Success!")
tk.Label(master=admin1, text="Admin User Successfully Deleted!").grid(row=1, column=1)
delete_users_scheduled.destroy()
elif user in manager:
del manager[user]
admin1 = tk.Tk()
admin1.title("Success!")
tk.Label(master=admin1, text=" Manager Successfully Deleted!").grid(row=1, column=1)
delete_users_scheduled.destroy()
if user in standard:
del standard[user]
admin1 = tk.Tk()
admin1.title("Success!")
tk.Label(master=admin1, text="Standard User Successfully Deleted!").grid(row=1, column=1)
delete_users_scheduled.destroy()

delete_users_scheduled = tk.Tk()
delete_users_scheduled.title("Delete A User")
tk.Label(master=delete_users_scheduled, text="Enter the Username").grid(row=1, column=0)
username = tk.Entry(master=delete_users_scheduled)
username.grid(row=1, column=1)
admin2 = tk.Button(master=delete_users_scheduled, text="Confirm Deletion", width=25,
command=deleting_back_user).grid(row=1, column=2)

manage_user_scheduled = tk.Tk()
manage_user_scheduled.title("Manage Users")
tk.Button(master=manage_user_scheduled, text="Add Users", width=25, command=adding_user).grid(row=1, column=0)
tk.Button(master=manage_user_scheduled, text="Delete A User", width=25, command=deleting_users).grid(row=2,
column=0)
tk.Button(master=manage_user_scheduled, text="View Current Users", width=25, command=display_users).grid(row=3,
column=0)


def update():
scheduled_update = tk.Tk()
scheduled_update.title("Update/Add A Flight")
tk.Label(master=scheduled_update, text="Enter The Flight Number").grid(row=1, column=0)
number_of_flight = tk.Entry(master=scheduled_update)
number_of_flight.grid(row=1, column=1)

def update_btn1():
if number_of_flight.get() not in scheduled:
scheduled[number_of_flight.get()] = ["", "", ""]
tk.Label(master=scheduled_update, text="Enter Departure Time").grid(row=3, column=0)
departure_time = tk.Entry(master=scheduled_update)
departure_time.grid(row=3, column=1)
tk.Label(master=scheduled_update, text="Enter Status").grid(row=4, column=0)
stat = tk.Entry(master=scheduled_update)
stat.grid(row=4, column=1)
tk.Label(master=scheduled_update, text="Enter Destination").grid(row=5, column=0)
destination_place = tk.Entry(master=scheduled_update)
destination_place.grid(row=5, column=1)

def update_btn2():
if departure_time.get() != "":
scheduled[number_of_flight.get()][0] = departure_time.get()
if stat.get() != "":
scheduled[number_of_flight.get()][2] = stat.get()
if destination_place.get() != "":
scheduled[number_of_flight.get()][1] = destination_place.get()
update_root = tk.Tk()
update_root.title("Successfully Updated!")
tk.Label(master=update_root, text="Successfully Updated!!").grid(row=0, column=0)
scheduled_update.destroy()

tk.Button(master=scheduled_update, text="Confirm", command=update_btn2).grid(row=6, column=1)

tk.Button(master=scheduled_update, text="Confirm", command=update_btn1).grid(row=2, column=1)
scheduled_update.mainloop()


def cancel(): # this function cancels flights
def back_cancelled():
flight = flight_number.get()
cancelled_scheduled.destroy()
if flight in cancelled:
root = tk.Tk()
root.title("Already Cancelled!")
tk.Label(master=root, text="Flight Already Cancelled. Please try again!").grid(row=1, column=1)
cancel()
elif not (flight in scheduled):
root = tk.Tk()
root.title("Flight Not Found!")
tk.Label(master=root, text="Flight Not Found. Please try again!").grid(row=1, column=1)
cancel()
else:
flight1 = scheduled.pop(flight)
del flight1[2]
flight1.append("Cancelled")
cancelled[flight] = flight1
root = tk.Tk()
root.title("Success!")
tk.Label(master=root, text="Flight Successfully Cancelled!").grid(row=1, column=1)

cancelled_scheduled = tk.Tk()
cancelled_scheduled.title("Cancel a Flight")
tk.Label(master=cancelled_scheduled, text="Enter the flight number").grid(row=1, column=0)
flight_number = tk.Entry(master=cancelled_scheduled)
flight_number.grid(row=1, column=1)
admin7 = tk.Button(master=cancelled_scheduled, width=25, text="Confirm", command=back_cancelled).grid(row=2,
column=1)


def admin_main_features(): # admin control panel
def switch_users_admin():
admin_main_scheduled.destroy()
login()

admin_main_scheduled = tk.Tk()
admin_main_scheduled.title("Admin Control Panel")
tk.Button(master=admin_main_scheduled, text="View The Details Of Flights", command=viewing_flights).grid(row=1,
column=1)
tk.Button(master=admin_main_scheduled, text="Switch User", command=switch_users_admin).grid(row=2, column=1)
tk.Button(master=admin_main_scheduled, text="Cancel A Flight", command=cancel).grid(row=4, column=1)
tk.Button(master=admin_main_scheduled, text="Manage Users", command=user_management).grid(row=5, column=1)
tk.Button(master=admin_main_scheduled, text="Exit The Program", command=exit).grid(row=6, column=1)
tk.Button(master=admin_main_scheduled, text="Update/Add A Flight", command=update).grid(row=3, column=1)


def manager_main(): # supervisor control panel
def switch_users_manager():
manager_main_scheduled.destroy()
login()

manager_main_scheduled = tk.Tk()
image = tk.PhotoImage(file="icon.png")
ask = tk.Label(master=manager_main_scheduled, image=image).grid(row=0, column=0)
manager_main_scheduled.title("Supervisor Control Panel")
tk.Label(master=manager_main_scheduled, text="").grid(row=6, column=0)
tk.Button(master=manager_main_scheduled, text="View The Details Of Flights", command=viewing_flights).grid(row=1,
column=1)
tk.Button(master=manager_main_scheduled, text="Switch User", command=switch_users_manager).grid(row=2, column=1)
tk.Button(master=manager_main_scheduled, text="Cancel A Flight", command=cancel).grid(row=4, column=1)
tk.Button(master=manager_main_scheduled, text="Exit The Program", command=exit).grid(row=5, column=1)
tk.Button(master=manager_main_scheduled, text="Update/Add A Flight", command=update).grid(row=3, column=1)
manager_main_scheduled.mainloop()


def viewing_flights(): # viewing flights
can = 0
ret = 1
display = tk.Tk()
display.title("View Details Of Flights")
tk.Label(master=display, text="Flight Number--------ETA--------Destination-------Status").grid(row=1, column=0)
for i in scheduled:
can += 1
ret += 1
tk.Label(master=display,
text=(i, "-------", scheduled[i][0], "--------", scheduled[i][1], "--------", scheduled[i][2])).grid(
row=ret, column=0)
for i in cancelled:
can += 1
ret += 1
tk.Label(master=display,
text=(i, "-------", cancelled[i][0], "--------", cancelled[i][1], "--------", cancelled[i][2])).grid(
row=ret, column=0)


def main_standard(): # standard user control panel
def switch_user_standard():
main_standard_scheduled.destroy()
login()

main_standard_scheduled = tk.Tk()
main_standard_scheduled.title("Standard User Control Panel")
tk.Button(master=main_standard_scheduled, text="View The Details Of Flights", command=viewing_flights).grid(row=2,
column=0)
tk.Button(master=main_standard_scheduled, text="Switch User", command=switch_user_standard).grid(row=3, column=0)
tk.Button(master=main_standard_scheduled, text="Exit The Program", command=exit).grid(row=4, column=0)
tk.Label(master=main_standard_scheduled, text="").grid(row=5, column=0)
img = tk.PhotoImage(file="icon.png")
no = tk.Label(master=main_standard_scheduled, image=img).grid(row=1, column=0)
main_standard_scheduled.mainloop()


def login(): # login function
def user_verification():
def password_verification():
pas = password.get()
if check == 1:
if admin[a] == pas:
login_sched.destroy()
admin_main_features()
reminder()
else:
admin3 = tk.Tk()
admin3.title("Wrong Password!")
tk.Label(master=admin3, text="Wrong Password! Please Try Again!").grid(row=1, column=1)

elif check == 2:
if manager[a] == pas:
login_sched.destroy()
manager_main()
reminder()
else:
admin3 = tk.Tk()
admin3.title("Wrong Password!")
tk.Label(master=admin3, text="Wrong Password! Please Try Again!").grid(row=1, column=1)
elif check == 3:
if standard[a] == pas:
login_sched.destroy()
main_standard()

else:
admin3 = tk.Tk()
admin3.title("Wrong Password!")
tk.Label(master=admin3, text="Wrong Password! Please Try Again!").grid(row=1, column=1)

a = username.get()

if not (a in admin or a in manager or a in standard):
admin1 = tk.Tk()
admin1.title("Wrong Username!")
tk.Label(master=admin1, text="Username Not Found. Please Try Again!").grid(row=1, column=1)
else:
if a in manager:
check = 2
elif a in admin:
check = 1
elif a in standard:
check = 3

tk.Label(master=login_sched, text="Enter Your Password").grid(row=2, column=0)
password = tk.Entry(master=login_sched, show='*')
password.grid(row=2, column=1)
admin3 = tk.Button(master=login_sched, text="Confirm Password", width=25,
command=password_verification).grid(row=2, column=2)

login_sched = tk.Tk()
login_sched.title("Login")
tk.Label(master=login_sched, text="").grid(row=5, column=1)
image = tk.PhotoImage(file="icon.png")
no = tk.Label(master=login_sched, image=image).grid(row=0, column=1)
tk.Label(master=login_sched, text="Enter Your Username").grid(row=1, column=0)
username = tk.Entry(master=login_sched)
username.grid(row=1, column=1)
asking = tk.Button(master=login_sched, text="Confirm Username", width=25, command=user_verification).grid(row=1,
column=2)
login_sched.mainloop()


login()


Downloadable Source Code 

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.

Conclusion

In this Flight Management System in Python with Source Code is free to download. Flight Management System 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.

Inquiries

If you have any questions or suggestions about Flight Management System in Python with Source Code , please feel free to leave a comment below.

1 thought on “Flight Management System in Python with Source Code”

  1. what packages should i install in the pycharm interpreter
    Traceback (most recent call last):
    File “C:/Users/PycharmProjects/flight1/main.py”, line 442, in
    login()
    File “C:/Users/PycharmProjects/flight1/main.py”, line 432, in login
    image = tk.PhotoImage(file=”icon.png”)
    File “C:\Users\AppData\Local\Programs\Python\Python38\lib\tkinter\__init__.py”, line 4064, in __init__
    Image.__init__(self, ‘photo’, name, cnf, master, **kw)
    File “C:\Users\AppData\Local\Programs\Python\Python38\lib\tkinter.
    I’m getting these errors . please kindly acknowledge.

    Reply

Leave a Comment