eric.brunel at pragmadev.com
Mon Aug 11 16:12:16 CEST 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.
> 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.
I wasn't thinking about this Event class. I thought about the one described here:
It allows very basic communications between threads.
> 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 ;)
Generating a *Tk* event is quite easy: just use the event_generate method that
exists on all widgets. I used it to generate simple events, often user-defined
one. The syntax is simple:
If you have a binding for "<<MyEvent>>" for myWidget, you can trigger it this way.
I never tried to pass event detail, though.
- Eric Brunel <eric.brunel at pragmadev.com> -
PragmaDev : Real Time Software Development Tools - http://www.pragmadev.com
More information about the Python-list