To be frank, I'm not overly happy with this. I asked:

"Please supply a short working script."

The code you've supplied does not even compile.

I also asked:

"Also provide verbatim copies of any warning or error messages you're seeing."

So, where is:

Global symbol "$user_entry_don" requires explicit package name at ... Execution of ... aborted due to compilation errors.

Would I be right in assuming that you didn't even bother to test this code?

In addition, I asked you to exclude any code that wasn't "relevant to the problem at hand". You've included four modules not used by the code you posted (Getopt::Long, Cwd, List::Util and Tk::ROText), a geometry() call (only suitable for particularly large screens) and other code: all irrelevant!

I changed:

$dialog_top->Button(-text=>"OK",-command=>sub {$user_entry_don +e = 1 unless($temp_var =~ m/^$/);})->pack;

to:

$dialog_top->Button(-text=>"OK",-command=>sub {$user_entry_don +e = 1 unless($temp_var =~ m/^$/);})->pack;

The script now compiles and runs without any error or warning output. The "Test" button pops up the Toplevel; I'm able to enter text from the keyboard in the Entry widget; the "OK" button removes the Toplevel.

I swapped the order of the Entry and Button widget code. Other than those widgets appearing in reverse order, the script runs the same as before.

I am unable to reproduce your problem.

I'm using Perl v5.18.1 and Tk v804.031 — perhaps try upgrading if you're using older versions.

-- Ken


In reply to Re^3: A very strange problem with entry, button widgets along with waitvariable(\$X) by kcott
in thread A very strange problem with entry, button widgets along with waitvariable(\$X) by rjohn1

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.