tkinter, problems destroying widgets

Aaron Watters (aaron@funcity.njit.edu)
Mon, 27 Mar 1995 18:36:45 GMT

Disclaimer:
Hi folks. I've been creating a forms interface using Tkinter,
mainly looking at the "life preserver", very small segments of
Ousterhout's book and the Demos files -- trying to actually
understand as little as possible to get the job done -- so I'm
sorry if this is a stupid question.

Problem:
I have problems getting a widget to exit and destroy
itself properly sometimes. I have no idea what causes the problem
-- it seems random to me.

Here is a code fragment that makes a highest frame with a
"start" and "end" button.
=========
# start up script for tk interface to sql interpreter
# borrows heavily from guido's dialog.py
def main():
from Tkinter import *
global mainWidget
mainWidget = Frame()
Pack.config(mainWidget)
labl = Label(mainWidget, {"text": "Welcome to tkDB"})
labl.pack()
start = Button(mainWidget,
{"text": "Load SQL and go", "command": go})
start.pack()
endit = Button(mainWidget,
{"text": "exit",
"command": terminate,
Pack: {"fill":"both"}})
mainWidget.messagearea = None
mainWidget.LOADED = 0

# is this right?
def terminate():
import sys
# do cleanup actions...
sys.exit()

def go():... do something complicated....
=================
The above is actually just the last of several attempts to remove this
problem.

Now, I thought that pressing the "exit" button any time should
terminate the whole tree of widgets, but sometimes it seems to do
nothing -- even if everything else has been terminated normally (as
far as I can see, anyway). I see this for other widgets also.
Someone tell me what I'm missing, or tell me what I should read,
please.

Aaron Watters
Department of Computer and Information Sciences
New Jersey Institute of Technology
University Heights
Newark, NJ 07102
phone (201)596-2666
fax (201)596-5777
home phone (908)545-3367
email: aaron@vienna.njit.edu

===
``I'm standing in the middle of the desert
waiting for my ship to come in.'' -- Sheryl Crow, _Leaving Las Vegas_