[Tkinter-discuss] thread module

mkieverpy at tlink.de mkieverpy at tlink.de
Sat Apr 5 17:24:00 CEST 2008


Hi Amit,

>1.   I created a global variable named "QuitThread" on my main module.
>2.   I initially set it to "False".
>3.   When clicking on the "Run" button of my GUI (defined in the main
>module), a new thread starts using start_new_thread, where QuitThread is
>one of the variables in its tuple.

This sounds wrong. You don't need QuitThread as a parameter to
start_new_thread.

>4.   This new thread runs a function from a second module. In this
>module I also added "import thread".
>5.   This function runs a loop in which it checks every iteration
>whether QuitThread is True or False.
>6.   If it is True, it executes "thread.exit()".
>7.   Nothing happens. The thread continues on running.

has your problem been solved in the mean time?
If not two things to check/try:
- thread.exit works by throwing an exception. Make sure you don't
  catch it by accident.
- Print/log value of QuitThread on every access in both threads.


Cheers,
------------------------------------------------------------------------------
Matthias Kievernagel                                      Software development
mkiever/at/web/dot/de                             http://mkiever.home.tlink.de
------------------------------------------------------------------------------


More information about the Tkinter-discuss mailing list