Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Set Directory Font in FileSelect

by Makena2016 (Initiate)
on Apr 15, 2016 at 17:57 UTC ( [id://1160549]=perlquestion: print w/replies, xml ) Need Help??

Makena2016 has asked for the wisdom of the Perl Monks concerning the following question:

Hello. I'm using FileSelect in a PERL/TK program. However, the font size is too small. If I change the font size with the -font option, it only changes the font size for the list of files. It doesn't change the font size for the list of directories, or action buttons. There doesn't seem to be an option to change those fonts. Does anyone know how I can change those fonts? Here's the example code:
my $MainWindow = MainWindow->new; my $fs = $MainWindow->FileSelect(-font => "Arial 24"); $fs->Show; MainLoop;
If you run the above in a PERL script, the font size for the list of files will be large (Arial 24), but for everything else, it's tiny.

Replies are listed 'Best First'.
Re: Set Directory Font in FileSelect
by beech (Parson) on Apr 15, 2016 at 23:27 UTC

    See Tk::WidgetDump for figuring out widgets, slightly easier than reading the source (of Tk::FileSelect)

    If you don't want all children to have same font size, select the child you want, use $fs->Subwidget('dir_entry')...

    #!/usr/bin/perl -- use strict; use warnings; use Tk; use Tk::WidgetDump; my $mw = Tk::MainWindow->new; my $fs = $mw->FileSelect( -font => "Arial 24" ); FontForKids( $mw , "Arial 24" ); $mw->WidgetDump; $fs->Show; sub FontForKids { my( $mw , $font ) = @_; my @kids = $mw->children ; while( @kids ){ my $kid = shift @kids; push @kids, $kid->children; eval { $kid->configure( -font => $font ); 1 } ## or warn $@; } return $mw; }
Re: Set Directory Font in FileSelect
by GotToBTru (Prior) on Apr 15, 2016 at 18:20 UTC

    Put together a short, self-contained, correct example. Very difficult to troubleshoot a problem without knowing how you're putting things together.

    Likely, the control you want is outside of Tk::FileSelect. It looks like it is chiefly concerned with selecting files, and not how they are displayed.

    But God demonstrates His own love toward us, in that while we were yet sinners, Christ died for us. Romans 5:8 (NASB)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1160549]
Approved by GotToBTru
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (3)
As of 2024-04-20 03:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found