Below is the sample code which depicts what I am trying to achieve,

Hi

perlintro, Modern Perl , the future is now :)

#!/usr/bin/perl -- #!D:\Strawberry\perl\bin\perl.exe ## ## ## perltidy -olq -csc -csci=10 -cscl="sub : BEGIN END if while for " +-otr -opr -ce -nibc -i=4 -pt=0 "-nsak=*" #!/usr/bin/perl -- use strict; use warnings; use diagnostics; use Tk; use Tk::ROText; my $mw = tkinit( -background => '#990033' ); my $sw = $mw->screenwidth; #1920 my $sh = $mw->screenheight; #1080 my $frame_width = $sw * 0.108; print "\$sw : $sw\n\$frame_width : $frame_width\n"; my $frame = $mw->Frame(); #~ my $txt = $frame->ROText( my $txt = $frame->Scrolled( 'ROText', -width => $frame_width, -height => 22, -font => "{sans serif} 10", -background => 'lightgray' ); Enter_labels_in_textarea( $txt->Subwidget('scrolled'), enter_values( $frame_width ) ); $txt->insert('end', "\n\n\n\n".rand."\n" ); $frame->pack(qw/ -expand 1 -fill both /); $txt->pack(qw/ -expand 1 -fill both /); #~ $txt->grid( -row => 9, -column => 1 ); #~ $txt-> $mw->WidgetDump; MainLoop(); exit( 0 ); sub Enter_labels_in_textarea { my( $rotext, $enter_values ) = @_; foreach my $val (@$enter_values) { my( $text, @options ) = @$val; my $label = $txt->Label( -foreground => 'white', -font => 10, -height => 1, -cursor => 'leftbutton', -relief => 'raised', -justify => 'left', -text => $text, @options, ); $rotext->windowCreate( 'end', -window => $label , ); print "$label $text @options\n"; } } sub enter_values { my( $frame_width ) = @_; return [ [ 1, -background => 'navyblue', -width => ( $frame_width * ((2+length '1') /100) ) ], [ 'NAME', -background => '#990033', -width => ( $frame_width * 0.16 ), ], [ 'AGE', -background => '#990033', -width => ( $frame_width * ((2+length 'AGE') /100) ), ], [ 'PROFESSION', -background => '#990033', -width => ( $frame_width * ((2+length 'PROFESSION')/100) ), ], [ 'CONTACT', -background => '#FF0000', -width => ( $frame_width * 0.16 ), ], [ 'ADDRESS', -background => 'darkgreen', -width => ( $frame_width * 0.24 ), ], ]; }

In reply to Re^2: Perl Tk : How to adjust labels width in textarea with every screen resolution. by Anonymous Monk
in thread Perl Tk : How to adjust labels width in textarea with every screen resolution. by Anonymous Monk

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.