in reply to killing a child process which contains a Tk Main window

I don't know the answer to this question. I do know that this fork() stuff in Windows doesn't work like in *NIX. The PID's under Windows are negative meaning that this is a thread emulation, not a really new PID. There is some code below.

When I write a Tk GUI with a long lived number cruncher app, I put up a Window with status and an "abort" button. This works because this is a single process and I call the thing managing the GUI progress bar often enough that the user won't notice any difference in performance if the user clicks on "stop". If you experiment with such an approach, you will find that updating the display is *very* expensive. On a 0-100% progress bar, you will find that you only want to update the display 100 times or maybe even only 50 times (once per 2%) (do a calculation and don't update the display more often than that). Looking about every 25 ms is way fast enough.

The way that you have described your app, it is started via a command line, not from the user "clicking a button" to start the "number cruncher". The Tk GUI creates lots of objects and then MainLoop() is called and the user then clicks on some button(s).

I think an equivalent question is: how to do I start a Tk GUI app and have my program punch one of the "go" buttons instead of the user having to do that?

#!/usr/bin/perl -w use strict; #this code is for WinXP, not Unix $| =1; #buffering is off! print "my Parent ID at start is: $$\n"; my $pid = fork(); if (!defined($pid)) { die "Couldn't fork"; } if ($pid == 0) #I am a child ## { print "My child PID =$$\n"; my $c =0; while ($c<10) { print $c++; sleep(1); } print "\n"; } else # I am parent ## { print "Parent PID = $$\n"; } print "end of PID = $$ process ID\n"; __END__ PRINTS: my Parent ID at start is: 3640 Parent PID = 3640 end of PID = 3640 process ID My child PID =-1628 0123456789 (one digit per second) end of PID = -1628 process ID