Aug-04-2023, 11:54 AM
(This post was last modified: Aug-04-2023, 11:54 AM by deanhystad.)
Still too late, You must assign username before making all the frames.
self.frames = {} for F in (home, register, login, menu, store, retrieve): page_name = F.__name__ frame = F(parent=container, controller=self) # <-- Error happens here self.frames[page_name] = frame frame.grid(row=0, column=0, sticky="nsew") self.show_frame("home") self.bind('<Escape>', lambda x: self.destroy()) global username # <-- This does nothing self.username = "" # <-- You don't assign value to username until hereThinking is required when programming. You get an error saying that the object does not have an attributed named "username", but obviously the class assigns an instance variable of that name. How is this possible? What sequence of events can result in getting this error? Sit down and look carefully at your code, focusing on where the error is reported and where you are assigning a value to "username". You are doing this:
x = username username = "a name"Here the problem is clear. Through careful analysis you can make the problem in your program just as clear. It just requires some thought.