in reply to Looping File transfer using SFTP in TK
I may be missing it but your program seems to only refer to sub1 one time, within the main body of the program
my $btn = $mw->Button(-text => 'Connect', -background => 'gray', -comm +and => \&sub1)->pack(-side => 'bottom', -padx => 3, -pady => 3, -anch +or => 'e');
I think you want a call to sub1 in sftp (I may be missing it). The sftp needs a way to check if 'stop' has been pushed and if not repeat the sftp subroutine.