@pattmax/

finance-helper

Tkinter

A GUI program that contains a suite of equations for quickly calculating things like interest, compound interest, and more.

fork
loading
Files
  • main.py
  • equations.py
  • nohup.out
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
import tkinter as tk
import tkinter.ttk as ttk
import equations

LastPage = None

class SampleApp(tk.Tk):
    def __init__(self):
        tk.Tk.__init__(self)
        self._frame = None
        self.switch_frame(StartPage)

    def switch_frame(self, frame_class):
        #Destroys current frame and replaces it with a new one.
        new_frame = frame_class(self)
        if self._frame is not None:
            self._frame.destroy()
        self._frame = new_frame
        self._frame.pack()

class StartPage(tk.Frame):
    def __init__(self, master):
        global LastPage
        tk.Frame.__init__(self, master)
        tk.Label(self, text="Finance Helper").pack(side="top", fill="x", pady=10)
        LastPage = StartPage
        tk.Button(self, text="Interest Calculators",
                  command=lambda: master.switch_frame(InterestCalculators)).pack()

class InterestCalculators(tk.Frame):
    def __init__(self, master):
        global LastPage
        tk.Frame.__init__(self, master)
        tk.Label(self, text="Simple Interest Calculators").pack(side="top", fill="x", pady=10)
        LastPage = InterestCalculators
        tk.Button(self, text="Home",
                  command=lambda: master.switch_frame(StartPage)).pack(side = "top")
        tk.Button(self, text="Simple Interest",
                  command=lambda: master.switch_frame(SimpleInterest)).pack()

class SimpleInterest(tk.Frame):
    def __init__(self, master):
        tk.Frame.__init__(self, master)
        tk.Label(self, text="Simple Interest").pack(side="top", fill="x", pady=10)
        tk.Button(self, text="Back",
                  command=lambda: master.switch_frame(LastPage)).pack(side = "left")
        tk.Button(self, text="Home",
                  command=lambda: master.switch_frame(StartPage)).pack(side = "left")
				

if __name__ == "__main__":
    app = SampleApp()
    app.mainloop()