Skip to content
Advertisement

KeyError for multiframe tkinter?

I keep getting a KeyError and I am unsure why. I added a print statement and printed the self.frames dict to ensure that the keys existed, and it appears they do. I’m new to using classes to create multi frame apps so any insight would be helpful.

The error:

JavaScript

The dict that prints:

JavaScript

The code where the error occurs:

JavaScript

Advertisement

Answer

The keys in your dictionary are the class names, then you’re trying to reference them by the class itself.

self.show_frame(StartPage) needs to be self.show_frame("StartPage")

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement