Hi Monks I have a Tk interface with 4 buttons one next to another. 2 of them execute subroutines of the form : do "esoda.pl"; and do "eksoda.pl"; . Those 2 files are stored in the current folder as expected. Now the other 2 buttons are using the Tk::Dialog module and they subroutines when are triggered display some information to the user. my $DialogRef = $mw->Dialog( -text =>$displayeksodasum ); $esodaSTmb = $DialogRef->Show; With the TK:Dialog module you can close the windows and return to the previous interface ( the initial with the 4 buttons remember?). But when i click the other 2 windows with code such as do "esoda.pl" or "eksoda.pl" when i close that window i exit the program without returning to the initial 4 button interface. I need some guidance in making the 2 last buttons to utilise Toplevel functionalities so whenever i leave that window to return to the previous interface. Now you may ask: why just do not copy what you have done for the first 2 buttons to the last 2, well the problem is that since are external files envoked i do not really fell confident plus i have serious thoughts of merging all three files eksoda.pl , esoda.pl and main.pl into one but this would be a catastrophe here is the code
MainLoop; ##**********************************************8 #when i click the button i window appears then close it #program exits sub openEksoda_button { do "eksoda.pl"; } sub openEsoda_button { #************************** #Same case here do "esoda.pl"; } sub Eksoda_Statistika_button { my @totalEksoda = (); my $eksodasum = 0; my $clearedeksodaValue=0; chdir "/home/props/delice/eksoda" or die "didn't make to eksoda folde +r\n"; foreach my $file (glob '*.txt') { open IN, $file; while (<IN>) { if ($_ =~ m/(Eksoda.*Total:)(.*\d)/) { $clearedeksodaValue =$2; push(@totalEksoda,$clearedeksodaValue); } #if } #end while } #end outer foreach foreach (@totalEksoda){ $eksodasum+= $_; } #end inner foreach chomp $eksodasum; my $displayeksodasum ='Ta eksoda einai:' ." $eksodasum"; #************************************************ #this works nicely since gets me back to previous interface without ex +iting the program my $DialogRef = $mw->Dialog( -text =>$displayeksodasum ); $esodaSTmb = $DialogRef->Show; } #end sub sub Esoda_Statistika_button { my @totalEsoda = (); my $esodasum = 0; my $clearedesodaValue=0; chdir "/home/props/delice/esoda" or die "didn't make to esoda folder\ +n"; foreach my $file (glob '*.txt') { open IN, $file; while (<IN>) { if ($_ =~ m/(Esoda.*Total:)(.*\d)/) { $clearedesodaValue =$2; push(@totalEsoda,$clearedesodaValue); } #if } #end while } #end outer foreach foreach (@totalEsoda){ $esodasum+= $_; } #end inner foreach chomp $esodasum; my $displaysum ='Ta esoda einai:' ." $esodasum"; #********************************************************* #here the same as expected my $DialogRef = $mw->Dialog( -text =>$displaysum ); $esodaSTmb = $DialogRef->Show; } #end sub

In reply to Tk-Toplevel related by props

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.