Repository navigation
Give the ttk widgets the space of the modern theme - #1090
Open
beetlebugorg wants to merge 2 commits into
Open
beetlebugorg wants to merge 2 commits into
beetlebugorg wants to merge 2 commits into
Conversation
A theme of Tk puts space in a few places, so a script with little -padx of its own still has room. ztk gave those places about 0, so the Login dialog of tkchat had no margins. The modern theme now fills them from a new spacing scale (--space-1 to --space-5): - the notebook insets its tabs and its client area from its edge, keeps margins around the row of tabs (the part ::tabs), and insets the page inside the client area; - a ttk button, check button, radio button, and menu button keep a margin for the focus ring inside their window; - a ttk label and label frame have padding. ttk::style lookup of -padding, -margin, and -tabmargins gives the value of the theme in the modern look, and configure of those options changes it. The classic theme keeps the values of wish.
This was referenced Dec 4, 2026
The -padding option of a notebook went into its CSS padding too, so it replaced the space of the theme at the edge of the notebook. It is the space around the pages, inside the client area, as in Tk. Two examples of docs/reference/ttk-notebook.tcl depended on the space at the edge: the one of -width compares two widths, and the one of identify uses a point inside the first tab.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1070. Part of #1067.
A theme of Tk puts space in a few places, so a script with little
-padxof its own still has room. ztk gave those places about 0, so the Login dialog of tkchat 1.600 had no margins. As the owner decided, the space comes from the theme of ztk. Wish shows only which places get space.(The Login dialog of tkchat as a small script, in the headless backend, from
ztk::snapshot. The pictures are on the branchshots/ttk-padding; delete it after the merge.)The places, from the new spacing scale of
modern.css(--space-1to--space-5: 2, 4, 8, 12, 16 px):ttk::style lookupTNotebook { padding }TNotebook -padding→8 4 8 8TNotebook::tabs { padding }(new part)TNotebook -tabmargins→4 0TNotebook::client { padding }TButton, TMenubutton { margin }TButton -margin→4 2TCheckbutton, TRadiobutton { margin }TCheckbutton -margin→2TLabel { padding }TLabel -padding→2TLabelframe { padding }TLabelframe -padding→8src/ttk/notebook.zig: the outer inset, the tab margins, and the client insets come from the CSS (the client border was a fixed 1 px).src/ttk/widgets.zig: the margin of a button, check button, radio button, or menu button is inside its window, as in Tk. The request size grows, and the box is drawn inside it. In a flex container the margin stays outside, as flex places it. Two checks that found a menubutton or a label by its function pointers now use the class (menubutton.zig,checks.zig).src/ttk/style.zig: in a theme that is not classic,lookupof-padding,-margin, or-tabmarginswith no setting of the script gives the CSS value of a probe widget of the style.configure -marginandconfigure TNotebook -tabmarginswrite rules. The classic theme keeps the values of wish (lookup TButton -paddingis3m 1m).ttk::style lookup TButton -paddingin the default theme was3 3(the number of wish) and is now12 6(what ztk draws).src/tests/ttk.zigchanges with it.src/tests/notebook.zig, "the Login dialog of tkchat has room at each edge": the room at each edge, the lookups, configure, and the classic theme.zig build testpasses with no update).TCombobox(its text hit test would need the offset), the defaults of the classic widgets, and Treeview cells. The native looks of Look and feel native on each platform, indistinguishable from native apps #154 later set their own values inaqua-macos.cssand the others (macOS look: the rest of the controls in aqua-macos.css, and the ttk forms of each #1071).docs/styling.md,docs/differences.md, CHANGELOG.Lines: estimate 250, actual +300 −18.