-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.py
124 lines (108 loc) · 6.39 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
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
from tkinter import *
import tkinter.ttk as table
import webbrowser as web
import people
import dashboard
import transaction
import passbook
# TODO: Testing the switching between frames (change_frame meethod)
def change_frame(frame, name, prev="None"):
global window, people_button, transactions_button, passbook_button
frame.destroy()
if name == "Dashboard":
frame = dashboard.get_frame(window)
frame.pack(side=TOP)
if prev == "People" or prev == "Transaction" or prev == "Passbook":
people_button.config(text="People", command=lambda: change_frame(frame, "People", "Dashboard"))
transactions_button.config(text="Transaction",
command=lambda: change_frame(frame, "Transaction", "Dashboard"))
passbook_button.config(text="Passbook", command=lambda: change_frame(frame, "Passbook", "Dashboard"))
people_button.pack(side=LEFT)
transactions_button.pack(side=LEFT)
passbook_button.pack(side=LEFT)
elif name == "People":
if prev == "Transaction":
people_button.config(text="Dashboard", command=lambda: change_frame(frame, "Dashboard", "People"))
transactions_button.config(text="Transaction", command=lambda: change_frame(frame, "Transaction", "People"))
passbook_button.config(text="Passbook", command=lambda: change_frame(frame, "Passbook", "People"))
if prev == "Passbook":
people_button.config(text="Dashboard", command=lambda: change_frame(frame, "Dashboard", "People"))
transactions_button.config(text="Transaction", command=lambda: change_frame(frame, "Transaction", "People"))
passbook_button.config(text="Passbook", command=lambda: change_frame(frame, "Passbook", "People"))
if prev == "Dashboard":
people_button.config(text="Dashboard", command=lambda: change_frame(frame, "Dashboard", "People"))
transactions_button.config(command=lambda: change_frame(frame, "Transaction", "People"))
passbook_button.config(command=lambda: change_frame(frame, "Passbook", "People"))
frame = people.get_frame(window)
frame.pack(side=TOP)
elif name == "Transaction":
if prev == "People":
transactions_button.config(text="Dashboard",
command=lambda: change_frame(frame, "Dashboard", "Transaction"))
people_button.config(text="People", command=lambda: change_frame(frame, "People", "Transaction"))
passbook_button.config(text="Passbook", command=lambda: change_frame(frame, "Passbook", "Transaction"))
if prev == "Passbook":
transactions_button.config(text="Dashboard",
command=lambda: change_frame(frame, "Dashboard", "Transaction"))
people_button.config(text="People", command=lambda: change_frame(frame, "People", "Transaction"))
passbook_button.config(text="Passbook", command=lambda: change_frame(frame, "Passbook", "Transaction"))
if prev == "Dashboard":
transactions_button.config(text="Dashboard",
command=lambda: change_frame(frame, "Dashboard", "Transaction"))
people_button.config(command=lambda: change_frame(frame, "People", "Transaction"))
passbook_button.config(command=lambda: change_frame(frame, "Passbook", "Transaction"))
frame = transaction.get_frame(window)
frame.pack(side=TOP)
elif name == "Passbook":
if prev == "People":
passbook_button.config(text="Dashboard",
command=lambda: change_frame(frame, "Dashboard", "Passbook"))
transactions_button.config(text="Transaction",
command=lambda: change_frame(frame, "Transaction", "Passbook"))
people_button.config(text="People", command=lambda: change_frame(frame, "People", "Passbook"))
if prev == "Transaction":
passbook_button.config(text="Dashboard",
command=lambda: change_frame(frame, "Dashboard", "Passbook"))
people_button.config(text="People", command=lambda: change_frame(frame, "People", "Passbook"))
transactions_button.config(text="Transaction",
command=lambda: change_frame(frame, "Transaction", "Passbook"))
if prev == "Dashboard":
passbook_button.config(text="Dashboard", command=lambda: change_frame(frame, "Dashboard", "Passbook"))
transactions_button.config(command=lambda: change_frame(frame, "Transaction", "Passbook"))
people_button.config(command=lambda: change_frame(frame, "People", "Passbook"))
frame = passbook.get_frame(window)
frame.pack(side=TOP)
# This method adds the menu to the program.
def add_menu(window):
menu = Menu(window)
window.config(menu=menu)
files_menu = Menu(menu)
help_menu = Menu(menu)
files_menu.add_command(label="Exit", command=window.quit)
about_menu = Menu(help_menu)
about_menu.add_command(label="Sandeep N S",
command=lambda: web.open("https://www.linkedin.com/in/sandeep-n-s-6b3888165/"))
about_menu.add_command(label="Suprad S Parashar",
command=lambda: web.open("https://www.linkedin.com/in/supradparashar/"))
help_menu.add_cascade(label="About", menu=about_menu)
menu.add_cascade(label="File", menu=files_menu)
menu.add_cascade(label="Help", menu=help_menu)
# Main Logic of the function
window = Tk()
window.title("Ledger and Transactions Maintenance System")
add_menu(window)
frame = dashboard.get_frame(window)
frame.pack(side=TOP)
navigation_frame = Frame(window)
people_button = Button(navigation_frame, text="People", command=lambda: change_frame(frame, "People", "Dashboard"))
transactions_button = Button(navigation_frame, text="Transactions",
command=lambda: change_frame(frame, "Transaction", "Dashboard"))
passbook_button = Button(navigation_frame, text="Passbook",
command=lambda: change_frame(frame, "Passbook", "Dashboard"))
quit_button = Button(navigation_frame, text="Quit", command=window.quit)
people_button.pack(side=LEFT)
transactions_button.pack(side=LEFT)
passbook_button.pack(side=LEFT)
quit_button.pack(side=LEFT)
navigation_frame.pack(side=BOTTOM)
window.mainloop()