CLI+GUI

Alex Martelli aleax at aleax.it
Mon Aug 11 10:03:44 EDT 2003


Michele Simionato wrote:

> Eric Brunel <eric.brunel at pragmadev.com> wrote in message
> news:<bh7hs3$dtk$1 at news-reader3.wanadoo.fr>...
>> I don't know if this is the problem, because you didn't say exactly when
>> the script hangs, but Tkinter apparently has problems when calls to it
>> are made from a thread different from the one into which it was
>> initialized. I'd use an Event between Tkinter's thread and Cmd's thread,
>> checking it regularly with Tkinter's after method.
>> 
>> HTH
> 
> It hangs immediately when I start the script by clicking on its icon.
> What do you mean with "I'd use an Event" ? I thought an Event object
> is automatically generated when I click on a widget, or press a key,
> or something. Are you saying can I can programmatically generate an
> Event, faking a real mouse/key press? How so? That is something I
> always wanted to know ;)

When talking of event objects in a context of synchronizing threads,
it seems likely one is talking about threading.Event in specific.  As 
the online docs for the threading module say:

Event()
A factory function that returns a new event object. An event manages a flag
that can be set to true with the set() method and reset to false with the
clear() method. The wait() method blocks until the flag is true.

all details are at:

http://www.python.org/doc/current/lib/event-objects.html


There is no implication whatsoever that such objects are "automatically
generated" by any GUI toolkit.  The terminology confusions are, alas,
almost inevitable.


Alex





More information about the Python-list mailing list