Strange terminal behavior after quitting Tkinter application

Chris ceball at gmail.com
Wed May 9 03:25:35 EDT 2007


On May 7, 10:02 pm, "Hamilton, William " <wham... at entergy.com> wrote:
> > From: Chris
> > >         I'll admit to being surprised at seeing a claim that atkinter
> > > application, started within an interactive session, without a
> mainloop,
> > > even runs... I could see it maybe happening from Idle, since Idle is
> > > running atkintermainloop, so the application bindings may have
> just
> > > become "added widgets" to the Idle loop (but of course, a second
> > > mainloop would conflict heavily).
>
> > You can try by building a workingTkinterGUI interactively from the
> > standard Python interpreter, and see that the GUI works (i.e.
> > processes events) at the same time.
>
> If you build it as a class (such as the code in Chris's original post)
> it works; if you do it all directly, nothing happens until you run
> mainloop().  It works, but I'm not sure that it was intended to work
> that way.  I think your problem is related to that difference.

Do you have any idea where I should go to find out the differences
between using mainloop() and not using it? So far I have found this
quitting problem (which does not occur on all platforms), and the need
to call update() or update_idletasks() after some operations, but no
others.

> You'll probably be better off creating a new interpreter window as part
> of your program, if you really need access to the interpreter alongside
> your GUI.  You may be able to extract IDLE's interpreter window and use
> it directly.

I really do need access to the interpreter alongside the GUI in my
real program*, since the GUI cannot really offer all the functionality
of the command line (or is a long way from doing so...). I do offer
simple access to the interpreter in my gui (via
code.InteractiveConsole and a text widget, but I agree with the author
of the comp.lang.python posting "Has anybody made a Tkinter text
widget into a terminal emulator?" (http://groups.google.com/group/
comp.lang.python/browse_thread/thread/a3f223f563205156/
fc729e1de51ca2dc): it's a shame to force people to use a particular
editor. I don't know if she found a solution; I haven't found anything
reasonable yet.


Thanks

* Actually it's not my program, it's an open-source software package
for modelling neural maps: topographica.org. The GUI code is being
reorganized.




More information about the Python-list mailing list