Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How does one modify existing font for ttk::label ?

35 views
Skip to first unread message

pal...@yahoo.com

unread,
Jan 6, 2006, 5:11:44 AM1/6/06
to
I want to create a Tile style where labels use the default font but are
underlined. In Tk, I can do this -

label .l -text "Foo"
pack .l
.l configure -font [concat [.l cget -font] [concat underline]]

How does one achieve the same effect in Tile? ttk::label has a -font
option but it seems to always return an empty string so I can't figure
out what font and size it is using. I tried looking at the TLabel
layout and configuration but nothing related to fonts showed up there
either.

Thanks in advance,

/Ashok

Andrés García

unread,
Jan 6, 2006, 11:05:04 AM1/6/06
to
pal...@yahoo.com wrote:

> I want to create a Tile style where labels use the default font but are
> underlined.

You can try something like:

set family [font configure TkTextFont -family]
set size [font configure TkTextFont -size]
font create underFont -family $family -size $size -underline 1
set a [ttk::label .a -font underFont -textvariable hi]
set hi Hello
pack $a

As for the font to use as a starting point, you have:

# TkDefaultFont -- default for GUI items not otherwise specified
# TkTextFont -- font for user text (entry, listbox, others).
# TkHeadingFont -- headings (column headings, etc)
# TkCaptionFont -- dialog captions (primary text in alert dialogs, etc.)
# TkTooltipFont -- font to use for tooltip windows

Andres

Joe English

unread,
Jan 8, 2006, 12:59:18 PM1/8/06
to
Ashok wrote:
>
>I want to create a Tile style where labels use the default font but are
>underlined. In Tk, I can do this -
>
>label .l -text "Foo"
>pack .l
>.l configure -font [concat [.l cget -font] [concat underline]]
>
>How does one achieve the same effect in Tile? ttk::label has a -font
>option but it seems to always return an empty string so I can't figure
>out what font and size it is using.

The tile widgets use symbolic fonts defined in
$tile::library/fonts.tcl, usually TkDefaultFont.


--Joe English

0 new messages