picandies
Posts: 186
Joined: Wed Nov 26, 2014 5:13 pm

Tkinter destroy ...not always working

Sat Jan 19, 2019 9:28 pm

Tkinter destroy ...not always working

I have a form with a button that makes a popup a (smaller form with a few buttons):

In the main window code
makePopUpOne(p1)
this calls:
def makePopUpOne(p1):
w.frmMotorCtrl = Frame(w.MainFrame)
w.frmMotorCtrl.configure(relief=GROOVE)...various graphics commands for fonts, position, etc
etc etc
w.buttonReverseYes_1.bind('<Button-1>',lambda e:YesReverse()) ...one of several popup form's buttons callbacks

hitting the "yes" button in the pop up callbacks to main window code
def YesReverse():
blah blah
do stuff
w.frmMotorCtrl.destroy() ....kills off the popup...works perfectly most of the time.
blah blah do more stuff


This works great...the popup shows up & hitting the buttons in the popup do their callback things & the popup is destroyed & goes away, as epected. HOWEVER, if makePopUpOne is called again with the popup open, the popup is never destroyed (remains on the screen, no matter how many times destroy is called)....even then, all the callbacks are executing fine, doing their work. The only thing that is not happening is the popup refuses to disappear. How can the popup be forced to close?

Return to “General discussion”