in reply to Re^2: Tk font size for ALL widgets
in thread Tk font size for ALL widgets

This ought to give you the idea. You can also throw images in there, but there are limitations.
#!/usr/bin/perl use strict; use warnings; use Tk; my $mw = MainWindow->new( -title => 'Testing Tk::Menu', -width => 500, -height => 100, -background => 'yellow', -name => 'Demo', ); $mw->minsize( 500, 300 ); my $bf = $mw->fontCreate('big', -family=>'arial', -weight=>'bold', -size=>int(-18*18/14)); my $menubar = $mw->Menu( -type => 'menubar', -font => "Verdana 18 bold", # -font => 'big' ); $mw->configure( -menu => $menubar ); $menubar->configure( -font => "Verdana 18 bold" ); #$menubar->configure( -font => 'big' ); my $m1 = $menubar->cascade( -label => 'File', -tearoff => 0, -menuitems => [ [ Button => 'New', -font => "Verdana 18 bold", -command => \&create_new_file ], [ Button => 'Open', -command => \&open_file, -font => 'big', -background => 'black', -foreground=> 'white', ], [ Button => 'Exit', -command => sub {exit} ], ] ); MainLoop; sub create_new_file { print "create_new_file...\n"; } sub open_file { print "open_file...\n"; } __END__

I'm not really a human, but I play one on earth. Cogito ergo sum a bum

Replies are listed 'Best First'.
Re^4: Tk font size for ALL widgets
by aplonis (Pilgrim) on Nov 16, 2007 at 17:03 UTC

    Yes. Thank you for that example. I really appreciate your input. But it only addresses the sub-widgets in the cascade.

    The menu bar itself, however, the part that says File, is still tiny.

    I refer to the top-most item, that which heads the cascade, and which is visible in the main window when all cascades are put away. Managing that, for font size (and also color) is still stumping me pretty good.

      Another example..... notice (as of the time I tested this with an older Tk), you need to predeclare the font with fontCreate. Newer Tk's seem to work. YMMV. Menus are so tricky. ;-)
      #!/usr/bin/perl use strict; use warnings; use diagnostics; use Tk; my $mw = MainWindow->new( -title => 'Testing Tk::Menu', -width => 500, -height => 300, -background => 'yellow', -name => 'Demo', ); $mw->minsize( 500, 300 ); my $bf = $mw->fontCreate('big', -family=>'arial', -weight=>'bold', -size=>int(-18*18/14)); my $menubar = $mw->Menu( -type => 'menubar', # -font => "Verdana 18 bold", # HAS NO EFFECT! -font => $bf ); $mw->configure( -menu => $menubar ); #$menubar->configure( -font => "Verdana 14 bold" ); # HAS NO EFFECT +! my $m1 = $menubar->cascade( -label => 'File', -tearoff => 0, -menuitems => [ [ Button => 'New', # -font => "Verdana 16 bold", # OK -font => 'big', -command => \&create_new_file ], [ Button => 'Open', -font => 'big', -command => \&open_file ], [ Button => 'Exit', -command => sub {exit} ], ] ); MainLoop; sub create_new_file { print "create_new_file...\n"; } sub open_file { print "open_file...\n"; } __END__

      I'm not really a human, but I play one on earth. Cogito ergo sum a bum
Re^4: Tk font size for ALL widgets
by steve_thorley (Initiate) on Jul 14, 2011 at 23:21 UTC

    How do I select fonts with two (or more) words? never mind worked it out

    $mw->Label( -font => "Verdana 18 bold" ); #this works

    $mw->Label( -font => "Times Roman 18 bold" ); #this Doesn't Work
    $mw->Label( -font => "'Times Roman' 18 bold" ); #this Doesn't Work
    $mw->Label( -font => "Times\ Roman 18 bold" ); #this Doesn't Work


    $mw->Label( -font => "Times\sRoman 18 bold" ); #this Works