[Tkinter] text widget update problem

Russell E. Owen owen at nospam.invalid
Mon Dec 2 15:26:56 EST 2002


In article <as7qjk$oivmv$1 at ID-28938.news.dfncis.de>,
 "Thomas Rademacher" <rademacher at prostep.FTA-berlin.de> wrote:

>Yes!!! I use threads:
>
>for ii in range(maxSession):
>    log.log(__name__, 0, "enter", "beforeThreads"); <-- logging in text
>widget WITHOUT problems
>
>    myS = session.Session(dxmDbServer, ii+1, maxDs, lang, cpu, usr, pwd,
>authmode, clienttype)
>    thread.start_new_thread(threadSession,(myS,))
>
>def threadSession(actSession):
>     global log
>     log.log(__name__, 0, "enter", "threadSession") <- logging in text
>widget WITH problems
>     log.log(__name__, 0, "input", actSession)
>     actSession.testSession()
>     log.log(__name__, 0, "leave", "threadSession")
>
>Have you an idea how can I resolve this problem?
>Thank's Thomas!

Tk GUI stuff should all run from the same (main) thread. If you want to 
pass data into the main thread from another thread, how about Queue 
objects? They're ideal for that job.

Also, I suggest using update_idletasks() instead of update() if you can; 
it's less likely to cause problems.

-- Russell



More information about the Python-list mailing list