I have a simple issue that I need some help with. Can someone give me a nudge in the right direction?

I am trying to define how many characters can be in a line in a Text Widget. I only want 30 characters on each line.

I do not have a piece of code that even comes close...I have looked and tried Tags and defining -rmargin, but that doesn't seem to do it....help!

#!c:\perl\bin\perl.exe -w use Tk; my $char= "&"; my $mw=MainWindow->new; my $t=$mw->Scrolled("Text",-height=>'45',-width=>'80')->pack(); $t->tagConfigure('tag',-font => "Courier 24 bold",-rmargin=>50); my $tm=500; my $try=Tk::After->new($mw,$tm,'repeat',\&loop); stop(); MainLoop; sub stop { $t->delete('1.0','end'); foreach (1..500) { $t->insert('1.0', ' '); } } sub loop { $num++; if($num==1){first(); } if($num == 3){ second(); } if($num == 4){ third(); } if($num == 5){stop(); $num=0;} } sub first { $t->insert('1.5',$char,'tag'); } sub second { $t->insert('3.6',$char); } sub third { $t->insert('3.7',$char); }

Thanks in advance,

witandhumor


In reply to Line size in a text widget by witandhumor

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.