Ejemplo n.º 1
0
    def search_in_database():
        def back_page2():
            search_frame.grid_forget()
            page2()

        global result
        global acc_no
        acc_no = entry11.get()
        r = check_string_in_account_no(acc_no)
        if len(acc_no) != 0 and r:
            result = backend.check_acc_no(acc_no)
            print(result)
            if not result:
                label = Label(search_frame, text="invalid account number")
                label.grid(pady=2)
                button = Button(search_frame, text="Exit", command=back_page2)
                button.grid()
                mainloop()
            else:

                def update_money():
                    new_money = entry12.get()
                    backend.update_balance(new_money, acc_no)
                    add_frame.grid_forget()
                    page2()

                search_frame.grid_forget()
                global add_frame
                add_frame = Frame(tk)
                add_frame.grid(padx=400, pady=300)

                detail = backend.get_detail(acc_no)

                label = Label(add_frame,
                              text='Account holder name:   {}'.format(
                                  detail[0][0]))
                label.grid(row=0, pady=3)

                label = Label(add_frame,
                              text='Current amount:   {}'.format(detail[0][1]))
                label.grid(row=1, pady=3)

                label = Label(add_frame, text='Enter Money')
                label.grid(row=2, pady=3)
                global entry12
                entry12 = Entry(add_frame)
                entry12.grid(row=3, pady=3)

                button = Button(add_frame, text='Add', command=update_money)
                button.grid(row=4)

                mainloop()
        else:
            label = Label(search_frame, text="Enter correct account number")
            label.grid(pady=2)
            button = Button(search_frame, text="Exit", command=back_page2)
            button.grid()
            mainloop()
Ejemplo n.º 2
0
    def search_in_database():
        def back_page2():
            search_frame.grid_forget()
            page2()
        global result
        global acc_no
        acc_no = entry11.get()
        r=check_string_in_account_no(acc_no)
        if len(acc_no)!=0 and r:
            result = backend.check_acc_no(acc_no)
            print(result)
            if not result:
                label = Label(search_frame, text="invalid account number")
                label.grid(pady=2)
                button=Button(search_frame, text="Exit",command=back_page2)
                button.grid()
                mainloop()
            else:
                def update_money():
                    new_money=entry12.get()
                    backend.update_balance(new_money,acc_no)
                    add_frame.grid_forget()
                    page2()

                search_frame.grid_forget()
                global add_frame
                add_frame=Frame(tk)
                add_frame.grid(padx=400,pady=300)

                detail = backend.get_detail(acc_no)

                label = Label(add_frame, text='Account holder name:   {}'.format(detail[0][0]))
                label.grid(row=0, pady=3)

                label = Label(add_frame, text='Current amount:   {}'.format(detail[0][1]))
                label.grid(row=1, pady=3)

                label=Label(add_frame,text='Enter Money')
                label.grid(row=2,pady=3)
                global entry12
                entry12=Entry(add_frame)
                entry12.grid(row=3,pady=3)

                button=Button(add_frame,text='Add',command=update_money)
                button.grid(row=4)

                mainloop()
        else:
            label = Label(search_frame, text="Enter correct account number")
            label.grid(pady=2)
            button = Button(search_frame, text="Exit", command=back_page2)
            button.grid()
            mainloop()