I have a bank system that's using a tkinter class to run the program with a graphical user interface looking like this:

LARGE_FONT = ("Verdana", 12)

class BankSystemGUI(tk.Tk):

    def __init__(self, *args, **kwargs):
        tk.Tk.__init__(self, *args, **kwargs)
        container = tk.Frame(self)

        container.pack(side="top", fill="both", expand=True)

        container.grid_rowconfigure(0, weight=1)
        container.grid_columnconfigure(0, weight=1)

        self.frames = {}

        for F in (LoginPage, PageOne):
            frame = F(container, self)

            self.frames[F] = frame

            frame.grid(row=0, column=0, sticky="nsew")

            self.show_frame(LoginPage)

    def show_frame(self, cont):
        frame = self.frames[cont]
        frame.tkraise()

class LoginPage(tk.Frame):

    def __init__(self, parent, controller):
        tk.Frame.__init__(self, parent)
        label_1 = tk.Label(self, text="Welcome to the Python Bank System", font=LARGE_FONT)
        label_1.pack(pady=10, padx=10)
        label_2 = tk.Label(self, text="~~~~~~~~~~~~~~~~~~~~~~~~~~~~~", font=LARGE_FONT)
        label_2.pack(pady=10, padx=10)

        button1 = tk.Button(self, text="Admin login", command=lambda: BankSystem.run_main_options)
        button1.pack()

        button2 = tk.Button(self, text="Quit Python Bank System", command=lambda: BankSystem.run_main_options)
        button2.pack()

        button3 = tk.Button(self, text="Visit page 1", command=lambda: controller.show_frame(PageOne))
        button3.pack()

class PageOne(tk.Frame):

    def __init__(self, parent, controller):
        tk.Frame.__init__(self, parent)
        label = tk.Label(self, text="Welcome to the first page", font=LARGE_FONT)
        label.pack(pady=10, padx=10)

        button1 = tk.Button(self, text="Back to home", command=lambda: controller.show_frame(LoginPage))
        button1.pack()

app = BankSystemGUI()
app.mainloop()

When pressing the home button, it's meant to be running this code and this function is in another class in the same python file called class BankSystem. 

class BankSystem(object):

    def run_main_options(self):
        loop = 1
        while loop == 1:
            choice = self.main_menu()
            if choice == 1:
                username = input("\n Please input admin username: ")
                password = input("\n Please input admin password: ")
                msg, admin_obj = self.admin_login(username, password)
                print(msg)
                if admin_obj != None:
                    self.run_admin_options(admin_obj)

                elif choice == 2:
                    print("This option is not available yet")

                elif choice == 3:
                    loop = 0
                    print("\n Thank-You for stopping by the bank!")

But I'm having so many issues with this program, first it kept saying BankSystem has no attribute 'LoginPage' but now it says 'NameError: name 'BankSystem' is not defined.

Can anyone please help me out? I'm having no luck at all finding the problem and I'm not a skilled programmer.

Many thanks,

Please help me out, thank you.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.