Can a Tkinter GUI check for abort script:

hg hg at nospam.org
Tue Dec 19 09:43:39 EST 2006


Michael Yanowitz wrote:

> Hello:
> 
>    I have successfully implemented a Tkinter GUI which has
> this (simplified here for explanation):
> +-------------------------------------+
> |  filename: [        ./test3.py]     |
> |                                     |
> |  [Run Script]                       |
> +-------------------------------------+
> 
>    But, now what I would like to do while the script is
> running, is replace the "Run Script" with "Abort Script".
> 
> +-------------------------------------+
> |  filename: [        ./test3.py]     |
> |                                     |
> |  [Abort Script]                     |
> +-------------------------------------+
> 
>    So, every tenth of a seconds or ??? better time, I
> would like to 'return' to the GUI and check if the
> "Abort Script" button has been pressed.
>    How do I do this? Or is there a better way to
> implement this?
> 
> Thanks in advance:
> Michael Yanowitz

It depends: As you cannot "kill" a thread in Python, you need some mechanism
to stop your script another way (is that a python script or
a .sh / .bat ? ... from what you're writing, it seems you're calling some
external entity which just might launch a bunch of processes)

So do you or not control the inner workings of that external script ?

If you don't, then "killing" might be the way as posted / clearly the
methord will change from environment to environment.

hg




More information about the Python-list mailing list