Hi Monks-

++mikepol for asking
++zentara for his answer (and all his much appreciated pTk expertise over the years)

I know this is an old thread, but just had a similar question and could not find a suitable answer anywhere (on-site or off-site).

After banging my head against things for long enough, I came up with this solution. Hopefully, it will help others in the future.

-Craig

use strict; use warnings; use Tk; use Tk::Text; use Tk::Font; use Data::Dumper; # Create pTk text window... my $mw = MainWindow->new(-title => 'Text Font'); my $txt = $mw->Scrolled('Text')->pack(-fill => 'x', -side => 'left'); # Get Current font... my $currfont = $txt->cget(-font); # Create new font by cloning & modifying current font... my $boldfont= $currfont->Clone(-weight=>'bold'); # configure new tag ('bold') causing tagged characters to use the new +bold font... $txt->tagConfigure('bold', -font => $boldfont); # Insert some text that is not tagged as bold... $txt->insert('end', "========================\n"); $txt->insert('end', "Default font requested:\n" . Dumper($currfont)); $txt->insert('end', "\nDefault font chosen:\n" . Dumper($currfont->act +ual)); # Insert some text that is tagged as bold... $txt->insert('end', "========================\n"); $txt->insert('end', "Bold font requested:\n" . Dumper($boldfont), ['bo +ld']); $txt->insert('end', "\nBold font chosen:\n" . Dumper($boldfont->actual +), ['bold']); MainLoop;

In reply to Re: increase font size in Perl TK by cmv
in thread increase font size in Perl TK by mikepol

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.