Skip to content

Give the combobox, the Treeview cells, and the classic widgets the spacing scale - #1102

Open
beetlebugorg wants to merge 2 commits into
ttk-paddingfrom
theme-paddings
Open

beetlebugorg wants to merge 2 commits into
ttk-paddingfrom
theme-paddings

Conversation

@beetlebugorg

Copy link
Copy Markdown
Owner

Stacked on #1090. The rest of #1070 in the modern look, from the spacing scale of modern.css (--space-1 to --space-5).

Summary

  • Combobox margin. TCombobox { margin: var(--space-1) } keeps room for the focus ring inside the window, as TButton -margin does.

    • The entry code draws the field in the box inside the margin (entry.frameRect). It also finds the text and the arrow there, and places the list there, so a click lands where the field is drawn.
    • identify gives an empty string in the margin.
    • ttk::style lookup TCombobox -margin gives 2.
  • Treeview cells and headings. Treeview::item and Treeview::heading have the padding var(--space-2) var(--space-3). The heading was 5 8 before.

    • ttk::style lookup of -padding for the styles Item and Heading, also Treeview.Item and Treeview.Heading with classes before them, gives 8 4.
    • configure of these styles writes a rule for the part ::item or ::heading.
  • Classic widgets.

    Widget Before After
    Button 6 12 4 12
    Entry 5 8 4 8
    Checkbutton, Radiobutton 3 2 2
    Labelframe 10 12 8 12

    When the script did not set the option, cget of -padx, -pady, and -highlightthickness gives the padding and the width of the focus ring that the look draws. This applies to button, label, entry, checkbutton, radiobutton, and labelframe. These are the new style props padx, pady, and focus_ring.

  • Docs: docs/styling.md (the table of the space of the theme and a table of the classic widgets) and docs/differences.md.

Fixes #1091

Pictures

The changed goldens are the before and after pictures: see the image diff of tests/golden/button-*.png, entry-*.png, demo-*.png, and grapheme-shot-*.png. examples/debug/golden-order.png is also made again. The numbers of docs/debug/visual-diff.md, docs/debug/input.md, and tests/debug-examples.sh follow the new size of the window.

Tests

  • zig build test passes, with a new test in src/tests/ttk.zig. It checks:
    • the cget values of each classic widget, and a value of the script that wins;
    • the lookup of Item and Heading, and the height of a row after configure Item -padding;
    • the margin of a combobox in its request height, and identify in the margin and on the arrow.
  • Three tests have the new values:
    • The entry's -highlightthickness is 2, the focus ring. The default stays 1, as in wish.
    • lookup TButton -padding gives 12 4.
    • The Login button of the notebook test is 31 high, and 27 with -margin 0.
  • tests/debug-examples.sh passes.
  • sh tools/ref-check.sh has only the 6 failures of Give the ttk widgets the space of the modern theme #1090, in docs/reference/ttk-notebook.tcl.

@beetlebugorg beetlebugorg added this to the v1.0.0-beta.10 milestone Dec 4, 2026
The modern theme now gives TCombobox the margin var(--space-1), inside
its window, as room for the focus ring. The entry code draws the field,
finds the text and the arrow, and places the list in the box inside the
margin (entry.frameRect), so a click lands where the field is drawn.

The cells and the headings of a Treeview take their padding from the
scale: var(--space-2) var(--space-3). `ttk::style lookup` of -padding
for the styles Item and Heading, also Treeview.Item and
Treeview.Heading, gives the space of the part, and `configure` writes a
rule for the part ::item or ::heading.

Refs #1091
The modern sheet now takes the padding of button, entry, checkbutton,
radiobutton, and labelframe from the spacing scale: Button 4 12 (was
6 12), Entry 4 8 (5 8), Checkbutton and Radiobutton 2 (3 2), and
Labelframe 8 12 (10 12). `cget` of -padx and -pady gives the padding of
the computed style, and -highlightthickness the width of the focus
ring, when the script did not set the option (the style props padx,
pady, and focus_ring of options.zig).

`identify` of a combobox gives an empty string in its margin.

The goldens of the button, the entry, the demo, and the grapheme shot
are made again, with the approval of the owner. So are the golden of
examples/debug and the numbers of its pages and of
tests/debug-examples.sh. Three tests have the new values.

Fixes #1091

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant