EDIT: I have fixed the problem!

I have a script that compiles an STL benchmark in C/C++ using various tools that the company I work for owns. It takes various input from the user through a GUI built with the Tk library. It works fine, compiles everything and then runs it but I have one problem. When you press the "compile" button, everything freezes in the UI and you have to watch the command prompt. I decided that to make the UI better, I should have a status box at the bottom that tells you what is going on and then tells you to watch the command prompt when the program is running. I started by making a frame underneath the compile button with a text box in, like so:

my $statusFrame = $main -> Frame(-background => 'white') -> pack(-side + => 'top', -fill => 'y'); my $status = $statusFrame -> Text(-background => 'black', -foreground +=> 'white') -> pack(-side => 'top', -pady => 9, -padx => 9);

I then made it so that in the compile subroutine, it inserts text into the textbox as it goes along:

sub compile { my $input = $ent0 -> get(); my $image = $ent1 -> get(); my $ccopts = $ent2 -> get(); my $linkopts = $ent3 -> get(); my $cpu = $ent4 -> get(); if($cpp) { $status -> insert("end","Compiling $input.cpp\n"); exit unless *****("$**opts","$input.cpp","$cpu"); # I blanked +out the tool names to hide the companies identity $ccopts .= " -cpp"; } else { $status -> insert("end","Compiling $input.c\n"); exit unless armcc("$**opts","$input.c","$cpu"); } $status -> insert("end","Compiling timer.c\n"); exit unless *****("$**opts","timer.c","$cpu"); $status -> insert("end","Linking $input.* and timer.*\n"); # Also +blanked out the file extensions typical to our company exit unless *******("$linkopts","$image","$input","timer"); # The +linking tool if($opsys eq "MSWin32") #if running windows { $status -> insert("\nRunning program, please watch the command + prompt\n"); exit unless runWindows("$image","$cpu"); } if($opsys eq "linux") #if running linux { $status -> insert("\nRunning program, please watch the termina +l\n"); exit unless runLinux("$image","$cpu"); } }

For some strange reason, the text box stays blank the whole time. I also tried using:

$status -> configure(-text => 'status here');

To no avail! Please help me magic monks!


In reply to Perl/tk Text Boxes insert problem by xSmallDeadGuyx

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.