• ttk::style: how to get the default font of a ttk::labelframe?

    From Ralf Fassel@[email protected] to comp.lang.tcl on Mon May 6 12:18:39 2024
    From Newsgroup: comp.lang.tcl

    Linux and Windows, tk 8.6.14

    Consider two labelframes:

    # using the "built-in" label
    ttk::style configure TLabelframe.Label -foreground blue
    pack [ttk::labelframe .lf1 -text "Labelframe 1"]
    pack [button .lf1.b -text Btn1]

    # using extra label widget as label
    pack [ttk::labelframe .lf2 ]
    label .lf2.lbl -text "Labelframe 2"
    .lf2 configure -labelwidget .lf2.lbl
    pack [button .lf2.b -text Btn2]


    How can I make the label of the second labelframe have the same font
    as the first? The color is readily available (since I set it myself),
    but I don't find any introspection for the *default* font itself in
    ttk::style:

    % ttk::style configure TLabelframe.Label
    [nothing]

    I *can* configure the font via
    ttk::style configure TLabelframe.Label -font {Helvetica 16}

    but I'd like to use the _default_ whatever it is on the different platforms.

    R'
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Emiliano@[email protected] to comp.lang.tcl on Mon May 6 09:18:45 2024
    From Newsgroup: comp.lang.tcl

    On Mon, 06 May 2024 12:18:39 +0200
    Ralf Fassel <[email protected]> wrote:

    Linux and Windows, tk 8.6.14

    Consider two labelframes:

    # using the "built-in" label
    ttk::style configure TLabelframe.Label -foreground blue
    pack [ttk::labelframe .lf1 -text "Labelframe 1"]
    pack [button .lf1.b -text Btn1]

    # using extra label widget as label
    pack [ttk::labelframe .lf2 ]
    label .lf2.lbl -text "Labelframe 2"
    .lf2 configure -labelwidget .lf2.lbl
    pack [button .lf2.b -text Btn2]


    How can I make the label of the second labelframe have the same font
    as the first? The color is readily available (since I set it myself),
    but I don't find any introspection for the *default* font itself in ttk::style:

    % ttk::style configure TLabelframe.Label
    [nothing]

    I *can* configure the font via
    ttk::style configure TLabelframe.Label -font {Helvetica 16}

    but I'd like to use the _default_ whatever it is on the different platforms.

    R'

    On my machine (X11)

    % ttk::style lookup TLabelframe -font
    TkDefaultFont

    Regards
    --
    Emiliano
    --- Synchronet 3.20a-Linux NewsLink 1.114
  • From Ralf Fassel@[email protected] to comp.lang.tcl on Mon May 6 14:31:16 2024
    From Newsgroup: comp.lang.tcl

    * Emiliano <[email protected]d>
    | On Mon, 06 May 2024 12:18:39 +0200
    | Ralf Fassel <[email protected]> wrote:
    --<snip-snip>--
    | > => How can I make the label of the second labelframe have the same font
    | > as the first? The color is readily available (since I set it myself),
    | > but I don't find any introspection for the *default* font itself in
    | > ttk::style:
    --<snip-snip>--

    | On my machine (X11)

    | % ttk::style lookup TLabelframe -font
    | TkDefaultFont

    I honestly swear that the 'lookup' section in the ttk::style manpage was
    not there when I checked it 2 hours ago...

    TNX ;-)
    R'
    --- Synchronet 3.20a-Linux NewsLink 1.114