Re: new Tkinter

Bill Janssen (
Tue, 21 Jun 1994 19:23:09 PDT

So let me try a bit harder to get rid of the windows (I must be doing
something wrong):

# module tktest
import Tkinter

def message (s):

tk = Tkinter.Tk()
top = Tkinter.Frame(tk, {Tkinter.Pack: {'side': 'top'}})
msg = Tkinter.Message(top, {'text': s, 'width': '3i',
Tkinter.Pack: { 'side': 'top', 'expand': 1,
'fill': 'both', 'padx': '3m', 'pady': '3m'}})
accept = Tkinter.Button(top, {'text': 'OK',
'command': lambda w=top:,
Tkinter.Pack: {'side': 'left',
'padx': 4, 'pady': 4,
'expand': 'true'}})
del tk
# end of module tktest

Now I do:

/import/python/src/Python 949 % python
Python 1.0.2 (Jun 8 1994)
Copyright 1991-1994 Stichting Mathematisch Centrum, Amsterdam
>>> import tktest
>>> tktest.message('foo')
>>> tktest.message('foo')
>>> tktest.message('foo')

Yes, there are 3 windows lying around on my screen...

Why the explicit "del" of "tk" doesn't do it, I don't see. It should
call Tkinter.Tk.__del__, which should destroy the root. But it doesn't
seem to.