Reputation: 1251
This is hard to explain so I will do my best.
I have a main program window with a button that is called "Backup/Restore". Pressing this button opens a new window with two buttons to choose from; "Backup" and "Restore". Pressing either of these button opens a third window with information on performing the action. Everything works great the first time I run either "Backup" or "Restore". If I close the second window with the two buttons on it; then press the "Backup/Restore" button from the main window it bring the second window with the two buttons back as it should, but the buttons labeled "Backup" and "Restore" do nothing when clicked. The buttons on the third window only lose their functionality after the second window has been closed once.
When creating the window I use the code:
def exportEFS(self): #this is the second window with two buttons
self.exportGUI = Toplevel()
Button(self.exportGUI, text='Backup', command=self.backup).pack(padx=100,pady=5)
Button(self.exportGUI, text='Restore', command=self.restore).pack(padx=100,pady=5
def backup(self): #this is the backup window that does not work if the second window has
been closed once.
self.backup = Toplevel()
<button code>
def restore(self): #this is the backup window that does not work if the second window has
been closed once.
self.restore = Toplevel()
<button code>
The code for the main window is too large to post, I'm not sure if any parts would help.
Upvotes: 0
Views: 1447
Reputation: 3159
...the function that calls the Toplevel window ("def backup(self):") has the same name as the Toplevel window itself ("self.backup = Toplevel()"), which is probably the cause of the problem. same with the "restore" option.
I had something like this, all was ok after I changed the name.
Upvotes: 3