Tkinter / Threads: "Invalid command name"

Russell E. Owen no at spam.invalid
Thu Dec 18 20:45:39 CET 2003

In article <3fe1e985$0$11374$91cee783 at>,
 Michael Schutte <m.schutte at> wrote:

>...I want to write a server application; like telnet is a client. The user
>should be able to bind() to a port and wait for a client. The written
>and recieved data is stored in a Text widget, self.__text. The
>accept()ing is done in a seperate thread (using the threading module),
>in method self.__tryConnect().
>But the seperate thread raises an exception at
>   self.__text["state"]="normal" .
>A part of the code:

You should only deal with Tkinter from the main thread.

(That was most certainly true in the past. I'm not quite positive that 
it is still supposed to be true, but I can assure you that it doesn't 
work well on my system.)

I suggest you use a Lock or Queue or some other inter-thread 
communication object to let the accept thread communicate with the rest 
of the application.

-- Russell

(You might also want to use Twisted framework.)

More information about the Python-list mailing list