| 9 | ctk.set_default_color_theme("blue") |
| 10 | |
| 11 | class App(ctk.CTk): |
| 12 | |
| 13 | def __init__(self,*args,**kwargs): |
| 14 | super().__init__(*args,**kwargs) |
| 15 | |
| 16 | def dispPie(self,M,N): |
| 17 | names = ['Invested Amount\n('+str(format(N,',d'))+')','Maturity Value\n('+str(format(M,',d'))+')'] |
| 18 | pi = np.array([N,M]) |
| 19 | fig = plt.figure(figsize=(5,5)) |
| 20 | |
| 21 | plt.pie(pi,labels= names) |
| 22 | plt.show() |
| 23 | |
| 24 | def Display(self,M,N): |
| 25 | self.MatDisp.configure(text=str(format(M,',d'))) |
| 26 | self.AmtDisp.configure(text=str(format(N,',d'))) |
| 27 | self.Details = ctk.CTkButton(self,text='Details',fg_color = '#E74C3C',border_color='#E74C3C',command = lambda: dispPie(self,M,N)) |
| 28 | self.Details.grid(row = 6, column = 0, padx = 20, pady = 20, sticky= 'ew') |
| 29 | # dispPie(self,M,N) |
| 30 | |
| 31 | |
| 32 | |
| 33 | |
| 34 | def getSip(self,amt,te,pe) : |
| 35 | P = amt |
| 36 | i = float(pe/12) |
| 37 | n = te*12 |
| 38 | |
| 39 | M = int(P * ((pow((1+i),n)-1)/i) * (1+i)) |
| 40 | N = int(amt*n) |
| 41 | print(M,N) |
| 42 | Display(self,M,N) |
| 43 | |
| 44 | def getLump(self,lsamt,te,pe): |
| 45 | P=lsamt |
| 46 | M = math.ceil(P*(pow(1+pe,te))) |
| 47 | print(M,P) |
| 48 | Display(self,M,P) |
| 49 | |
| 50 | |
| 51 | def mixedletters(quant): |
| 52 | for i in range(len(quant)): |
| 53 | if quant[i].isalpha(): |
| 54 | return True |
| 55 | return False |
| 56 | |
| 57 | def pressedCalculate(): |
| 58 | |
| 59 | global tenure |
| 60 | if self.ten.get() == '': |
| 61 | messagebox.showerror('Error','Please enter the tenure of your investment') |
| 62 | return |
| 63 | elif '.' in self.ten.get(): |
| 64 | messagebox.showerror('Error','Entered a fractional value') |
| 65 | return |
| 66 | elif self.ten.get().isalpha() or mixedletters(self.ten.get()): |
| 67 | messagebox.showerror('Error','Only numerical values allowed') |
| 68 | return |