[Tutor] TKinter display dialog 2nd time?

Bob Gailer bgailer@alum.rpi.edu
Thu Mar 20 11:06:45 2003


--=======1C334F31=======
Content-Type: text/plain; x-avg-checked=avg-ok-40B47E0; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 8bit

I find it amusing that, having stated a month or so ago that I have no 
interest in TKinter, now I'm using it. I find the various reference 
materials to be inadequate to help me really understand what's going on. 
The immediate problem is, I want to display a dialog, allow the user to 
close it, then display it again. Attempts to display it again lead to no 
results or errors

class App(Frame):
   def __init__(self, txt='Start', parent=Tk()):
     Frame.__init__(self, parent)
     self.pack()
     self.Label = Label(self, font = 'arial 8, txt')
     self.Label.pack({"side": "top"})
     self.QUIT = Button(self, text = "OK", command = self.quit)
     self.QUIT.pack({"side": "top"})

if __name__ == '__main__':
   app = App('txt')
   app.mainloop()

So far so good.

If I follow this with another app.mainloop(), nothing happens.

If I follow this with app = App('txt') I get:
....
  File "P:\Python22\lib\lib-tk\Tkinter.py", line 2257, in __init__
    Widget.__init__(self, master, 'frame', cnf, {}, extra)
  File "P:\Python22\lib\lib-tk\Tkinter.py", line 1764, in __init__
    self.tk.call(
clError: can't invoke "frame" command:  application has been destroyed

What am I missing. What do I need to do to redisplay the dialog?

Bob Gailer
PLEASE NOTE NEW EMAIL ADDRESS bgailer@alum.rpi.edu
303 442 2625

--=======1C334F31=======
Content-Type: text/plain; charset=us-ascii; x-avg=cert; x-avg-checked=avg-ok-40B47E0
Content-Disposition: inline


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.463 / Virus Database: 262 - Release Date: 3/17/2003

--=======1C334F31=======--