For Programmers: Free Programming Magazines  


Home > Archive > PerlTk > April 2006 > changing font in tk-app during run time









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author changing font in tk-app during run time
Johan Meskens CS3 jmcs3

2006-04-07, 7:00 pm


hello

is it possible to change the font for the complete application
during runtime from within the application itself ?
par example by selecting a value in a combo-box ?

# i know there is redundancy in my wording
# , ' on runtime too '

thank you
jmcs3



-++**==--++**==--++**==--++**==--++**==--++**==--++**==
This message was posted through the Stanford campus mailing list
server. If you wish to unsubscribe from this mailing list, send the
message body of "unsubscribe ptk" to majordomo@lists.stanford.edu

Petr Vileta

2006-04-07, 7:00 pm

"Johan Meskens CS3 jmcs3" <johanmeskenscs3@chromaticspaceandworld.com> píše
v diskusním příspěvku news:1144433169.3097.12.camel@localhost.localdomain...
>
> hello
>
> is it possible to change the font for the complete application
> during runtime from within the application itself ?
> par example by selecting a value in a combo-box ?
>

Yes. Create font like this

use Tk::Font;

our $mw = MainWindow->new();
our $font1 = $mw->fontCreate(-family => 'Helvetica', -size => 8, -weight =>
'normal');

and define subroutine for OK button of your "Select font dialog". For
example this dialog return minimal 3 parameters: font family/name, font size
and font weight, or may return another (slant, underline, overstrike).

sub change_font {
my ($name, $size, $weight) = select_font_name(); # this is your dialog about
fonts
$font1->configure(-family => $name, -size => $size, -weight => $weight);
$mw->update;
}

--

Petr Vileta, Czech republic
(My server reject all messages from Yahoo and Hotmail. Send me your mail
from another non-spammer site please.)


Slaven Rezic

2006-04-07, 7:00 pm

Johan Meskens CS3 jmcs3 <johanmeskenscs3@chromaticspaceandworld.com> writes:

> hello
>
> is it possible to change the font for the complete application
> during runtime from within the application itself ?
> par example by selecting a value in a combo-box ?
>


See the RefontTree method in the Tk::FontDialog module.

Regards,
Slaven

--
Slaven Rezic - slaven <at> rezic <dot> de

tkrevdiff - graphical display of diffs between revisions (RCS, CVS or SVN)
http://ptktools.sourceforge.net/#tkrevdiff
-++**==--++**==--++**==--++**==--++**==--++**==--++**==
This message was posted through the Stanford campus mailing list
server. If you wish to unsubscribe from this mailing list, send the
message body of "unsubscribe ptk" to majordomo@lists.stanford.edu

Johan Meskens CS3 jmcs3

2006-04-07, 7:00 pm

On Fri, 2006-04-07 at 21:29 +0200, Slaven Rezic wrote:
> Johan Meskens CS3 jmcs3 <johanmeskenscs3@chromaticspaceandworld.com> writes:
>
>
> See the RefontTree method in the Tk::FontDialog module.


<http://cvs.sourceforge.net/viewcvs..../Tk-FontDialog/>

yes
, this is quite fantastic !!!

thank you
jmcs3

>
> Regards,
> Slaven
>


-++**==--++**==--++**==--++**==--++**==--++**==--++**==
This message was posted through the Stanford campus mailing list
server. If you wish to unsubscribe from this mailing list, send the
message body of "unsubscribe ptk" to majordomo@lists.stanford.edu

Petr Vileta

2006-04-07, 10:00 pm

"Slaven Rezic" <slaven@rezic.de> píše v diskusním příspěvku
news:e16igj$or0$1@rain.CC.Lehigh.EDU...
>
> See the RefontTree method in the Tk::FontDialog module.
>

My eye! :-) I know nothing of this module.

--

Petr Vileta, Czech republic
(My server reject all messages from Yahoo and Hotmail. Send me your mail
from another non-spammer site please.)


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com