0

I am having difficulty updating the text of a variable after login. A user must log in to the program, and then the program saves their data in a dataStore list. From here, I'm trying to update 2 labels on a seperate frame opened once the user has logged in. However they won't seem to update.

Long story short, how can I make the tkinter frame load when it is to be shown to the user rather than at the beginning. Or even how to reload everything so the functions are run again to update.

Run when Login button is pressed:

cont.show_frame(MainPanel)

MainPanel function to update labels:

def setUser(self, cont, args):
    userset = self.widgets["usrLabel"].config(text='User: %s' %(DataStore.userData['username']))

(MainPanel) self.widgets:

self.widgets = {
    "usrLabel" : self.create_widget(controller, ["Label", "User:", 15, 10]),
    "typeLabel" : self.create_widget(controller, ["Label", "Type:", 15, 30]),
    ...
}
Ayden
  • 33
  • 1
  • 6
  • I've tried adding a function call to the login command to run MainPanel.setUser(MainPanel, cont, DataStore.userData) from the LoginPanel but it's just created error after error, and even after being clear of errors, it still wouldn't work. – Ayden Jan 08 '18 at 17:39
  • @Nae Everything I can put without putting the whole document of code is there. I'm not sure what else to add. – Ayden Jan 08 '18 at 17:41
  • 1
    I don't really understand your question, but maybe [this example](https://gist.github.com/novel-yet-trivial/3e2863fef2b8cd2afa317ff0c7389d3d) of how to make a password box will help you. – Novel Jan 08 '18 at 17:45
  • That's not exactly what [mcve] means. – Nae Jan 08 '18 at 17:47

0 Answers0