Ich habe ein Problem mit diesem Code. Um die Hypothek zu berechnen, wie viel Sie für Ihre Hypothek monatlich bezahlen, kann trotz allem jeder, mit dem ich gesprochen habe, nicht bestimmen, was das Problem ist. Also bin ich hierher gekommen, um zu sehen, ob einer von euch in der Lage ist zu helfen? Vielen Dank :)Ich kann nicht herausfinden, was falsch mit meinem Tkinter Mortgage Calculator ist? Jeder Rat wäre toll
from tkinter import * #Imports the tkinter library
mortgage=Tk() #Names the interface as 'mortgage'
mortgage.geometry("800x500+200+200") #Defines the dimensions of the interface
mortgage.title("Mortgage")
#calculation method
def Calculate():
loantotal1=float(loantotal.get())
interestrate1=float(interestrate.get())
loanperiod1=float(loanperiod.get())
interestCalculation =float(interestrate1/100)
totalcost = float(loantotal1 * interestCalculation)
numberofmonths=float(loanperiod1/12)
monthlycost= float(totalcost/loanperiod1)
monthly_period.set=("Your monthly payment %2.f "%monthlycost)
#variables
loantotal=StringVar()
interestrate=StringVar()
loanperiod=StringVar()
monthly_period=StringVar()
#interface
welcome_message=Label(mortgage,text="Find out how much you'll pay monthly for your mortgage,",font="Arial 12 bold",fg="#000000").pack()
instruction_message=Label(mortgage,text="Enter your details below and then Click submit:",font="Arial 12 bold",fg="#000000").pack()
loanTotal=Label(mortgage,text="Loan Total:",font="Arial 11 bold",fg="#000000").place(x=280,y=63)
loanTotal=Label(mortgage,text="£",font="Arial 11 bold",fg="#000000").place(x=550,y=63)
loanTotal_textbox=Entry(mortgage,textvariable=loantotal).place(x=400,y=65)
interestRate=Label(mortgage,text="Interest Rate:",font="Arial 11 bold",fg="#000000").place(x=280,y=88)
interestRate=Label(mortgage,text="%",font="Arial 11 bold",fg="#000000").place(x=550,y=88)
interestRate_textbox=Entry(mortgage,textvariable=interestrate).place(x=400,y=90)
loanPeriod=Label(mortgage,text="Loan Period:",font="Arial 11 bold",fg="#000000").place(x=280,y=113)
loanPeriod=Label(mortgage,text="Years",font="Arial 11 bold",fg="#000000").place(x=550,y=113)
loanPeriod_textbox=Entry(mortgage,textvariable=loanperiod).place(x=400,y=115)
Label(mortgage,textvariable=monthly_period).place(x=400,y=135)
submit_button=Button(mortgage,text="Calculate",command=Calculate,font="Arial 11 bold",fg="#000000").place(x=280,y=170)
mortgage.mainloop()
Könnten Sie bitte etwas konkreter sein: Was erwarten Sie? Was geschieht? – maij