Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #22411

Tkinter: IDLE can't get out of mainloop

Subject Tkinter: IDLE can't get out of mainloop
From Frederic Rentsch <anthra.norell@bluewin.ch>
Date 2012-03-31 09:42 +0200
Newsgroups comp.lang.python
Message-ID <mailman.1172.1333179854.3037.python-list@python.org> (permalink)

Show all headers | View raw


Hi all,

Is is a bad idea to develop Tkinter applications in IDLE? I understand
that IDLE is itself a Tkinter application, supposedly in a mainloop and
mainloops apparently don't nest.

I tried to install a root-destroy-protocol:

def destroy_root ():
	print 'Destroying root'
	root.destroy ()

root.protocol ("WM_DELETE_WINDOW", destroy_root)

I see the tracing message 'Destroying root', but stay stuck unable to
get the IDLE prompt back. Ctr-C doesn't work. The only way out I know is
killing IDLE. When I do, a warning says that a program is still running.
That must be IDLE's own WM_DELETE_WINDOW protocol. Is there a way to get
the prompt back without killing IDLE? Is there a way to nest a
mainloop? 
   Up to now I have been able to get by without a mainloop. I suppose
this is because I have only been doing layouts. Starting now to do
events I observe what in the absence of a mainloop looks like
synchronization problems with bindings responding to other events than
their own.
   If I run from a terminal things seem to work out. Is it standard
development practice to run code from a terminals ($ python program.py)?
What's the 'program.pyc' for if the source is compiled every time?
   I use Python 2.6 on Ubuntu 10.04 LTS.
 
Thankful for any suggestion

Frederic

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Tkinter: IDLE can't get out of mainloop Frederic Rentsch <anthra.norell@bluewin.ch> - 2012-03-31 09:42 +0200

csiph-web