G'day jsteng,

To the best of my knowledge, you cannot do this with Tk::Entry; however, you can code this functionality with Tk::Text.

The following code is fully functional. It shows how to set up the pseudo-entry widget (note the initial text has no spaces; just 12345). The "Latest Entry" button will retrieve the full, possibly edited, text (note the chomp) and update the display above.

#!/usr/bin/env perl use strict; use warnings; use Tk; my $mw = MainWindow::->new(-title => 'Vertical Entry'); $mw->geometry('300x400+40+40'); my $string = '12345'; my $entry = $mw->Text(-width => 1, -wrap => 'char'); $entry->pack(-fill => 'y', -side => 'left'); $entry->insert('1.0', $string); $mw->Label(-textvariable => \$string) ->pack(-fill => 'x', -side => 'top'); $mw->Button(-text => 'Latest Entry', -command => sub { chomp($string = $entry->get('1.0', 'end')) }) ->pack(-fill => 'x', -side => 'top'); $mw->Button(-text => 'Exit', -command => sub { exit }) ->pack(-side => 'bottom'); MainLoop;

It looks pretty weird to me, but that's what you asked for. :-)

— Ken


In reply to Re: how to write a vertical TK Entry? by kcott
in thread how to write a vertical TK Entry? by jsteng

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.