Ok, what I think you are saying is that you want an input widget that you can type in and a msg area to display output, based on what was typed in the input box.
That's actually very simple:
  • create a mainwindow
  • create an entry widget and a msg widget as children of the window and pack them.
  • bind to the enter key in the entry widget a routine that updates the msg area with the appropriate msg.
    That's it. Here's an example:
    #!/usr/local/bin/perl use Tk; use strict; my $mw = Tk::MainWindow->new(); my $entryv; my $msgv; my $entry = $mw->Entry(-textvariable => \$entryv)->pack(-side => 'top' +,-fill => 'x'); my $msg = $mw->Message(-textvariable => \$msgv)->pack(-side => 'top',- +fill => 'both'); $entry->bind('<Return>',sub {$msgv = uc($entryv)}); Tk::MainLoop();


    -pete
    Entropy is not what is used to be.

    In reply to Re: how Tk wedgets interact? by dreadpiratepeter
    in thread how Tk wedgets interact? by benlaw

    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.