LoanMortgageCalculatorGUI.py 文件源码

python
阅读 15 收藏 0 点赞 0 评论 0

项目:Miniprojects 作者: Ivy-Coding-Camp 项目源码 文件源码
def __init__(self, parent, controller, number_of_months, balances, interests, principals):
        tk.Frame.__init__(self, parent)
        self.controller = controller
        label = tk.Label(self, text="Mortgage Visualization", font=LARGE_FONT)
        label.pack(pady=10,padx=10)

        Button(self, text="Back", command=lambda: controller.show_frame(InputPage)).pack()

        months = list()

        i = 1
        while i <= number_of_months:
            months.append(i)
            i = i + 1

        f = Figure()
        f.subplots_adjust(left=0.15, right=0.95, wspace=0.25, hspace=0.75)
        a = f.add_subplot(211)
        plot1, = a.plot(months, interests,'r')
        plot2, = a.plot(months, principals,'g')

        b = f.add_subplot(212)
        plot3 = b.plot(months, balances, 'b')

        canvas = FigureCanvasTkAgg(f, self)
        canvas.show()
        canvas.get_tk_widget().pack(side=tk.BOTTOM, fill=tk.BOTH, expand=True)

        toolbar = NavigationToolbar2TkAgg(canvas, self)
        toolbar.update()
        canvas._tkcanvas.pack(side=tk.TOP, fill=tk.BOTH, expand=True)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号