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.
Watch the video here to see the full running flight management system in python projects with source code.
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.
Steps on how to create Flight Management System in Python
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“.
- 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 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.
1 |
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)
1 2 3 4 5 6 7 8 9 10 |
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)
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 |
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)
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 |
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)
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 |
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)
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 |
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)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
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.
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 |
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.
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 |
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.
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 |
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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
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.
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 |
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
1 |
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 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 |
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() |
Run Quick Virus Scan for secure Download
Run Quick Scan for safe DownloadDownloadable 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.
Related Articles
- Python MySQL UPDATE Query: Step-by-Step Guide in Python
- Bank Management System Project in Python With Source Code
- Python MySQL INSERT Query: Step by Step Guide in Python
- How To Make Game In Python With Source Code
- Complaint Management System Source Code In PHP
- 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 Flight Management System in Python with Source Code , please feel free to leave a comment below.