Michele Simionato mis6 at
Tue Aug 12 23:35:00 CEST 2003

danbmil99 at (dan) wrote in message news:<fbf8d8f2.0308120814.75e8dff at>...
> Late to this thread, but --
> in a similar situation, I just put:
>   _tkinter.dooneevent(_tkinter.DONT_WAIT)
> in my main logic loop (cmd interpreter in your case), instead of
> calling Frame.mainloop().  I believe Frame.update() does something
> similar but for some reason this worked better.
> ISTM this would be cleaner (and safer) than using threads.  You can do
> all your draw operations from your command line routines, and they
> will get displayed as soon as the routine returns to your main loop to
> wait for more input.
> Am I missing something?
> -dbm

I like quite a lot you suggestion! "dooneevent" was the method I was
looking for! Actually, I would rather prefer to avoid threads for such a
simple program. Thanks to the power of Python I wrote down a working
script in less than five minutes, even if probably I will need more
than five minutes to understand what I wrote ;)
Here it is:

import Tkinter as t
import cmd


class Cmd(cmd.Cmd):
    def do_display(self,arg):
    def do_quit(self,arg):
        return 'quit' # anything != None will do


I will later try it on Windows 98. Dunno exactly what "dooneevent" is doing,
I searched my python directories for "dooneevent" and found only one
usage of "doonevent" and copied it ;) Unfortunately "dooneevent" 
has no docstring, however few experiments show that "dooneevent()" 
is the same that "dooneevent(0)" whereas "dooneevent(1)" hangs up 
(it is waiting for what??)

Thanks for your help,


More information about the Python-list mailing list