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

    From Ralf Fassel@21:1/5 to All on Mon May 6 12:18:39 2024
    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'

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Emiliano@21:1/5 to Ralf Fassel on Mon May 6 09:18:45 2024
    On Mon, 06 May 2024 12:18:39 +0200
    Ralf Fassel <ralfixx@gmx.de> 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

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Ralf Fassel@21:1/5 to All on Mon May 6 14:31:16 2024
    * Emiliano <emil.g@example.invalid>
    | On Mon, 06 May 2024 12:18:39 +0200
    | Ralf Fassel <ralfixx@gmx.de> 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'

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)