Interactive use of Tk

Stuart Reynolds S.I.Reynolds at cs.bham.ac.uk
Fri Jul 23 13:26:47 EDT 1999


I'm trying to debug a tkinter application I have using the interactive
prompt via XEmacs. The program runs fine first time around but when run
again (without exiting the interactive prompt) it complains that the
application has been destroyed. How to I stop the application from being
destroyed?

Secondly, has anyone managed to get tkinter windows running whilst still
being able to use the interactive prompt (e.g. by starting the mainloop
in a separate thread). I guess its possible and its just the dodgy
Solaris threads libraries we have installed here that stop it working
for (the jpython examples also cause the command prompt to block for
me).



Cheers,

Stuart

PS. The code which won't run twice:

-----
if __name__ == '__main__':


    from Tkinter import *
    frame = Frame()
    ... some other code here ...
    Pack.config(frame)
    frame.mainloop()
    
-------


#Works fine:
>>> ## working on region in file /usr/tmp/python1f5be_...
>>> 
#Run again:
>>> ## working on region in file /usr/tmp/pythonh2FQL_...
Traceback (innermost last):
  File "<stdin>", line 1, in ?
  File "/usr/tmp/pythonh2FQL_", line 117, in ?
    frame = Frame()
  File
"/bham/ums/common/pd/packages/Python/lib/python1.5/lib-tk/Tkinter.py",
line 1406, in __init__
    Widget.__init__(self, master, 'frame', cnf, {}, extra)
  File
"/bham/ums/common/pd/packages/Python/lib/python1.5/lib-tk/Tkinter.py",
line 1084, in __init__
    self.tk.call(
TclError: can't invoke "frame" command:  application has been destroyed




More information about the Python-list mailing list