Tk Source Code

View Ticket
Login
Ticket UUID: e6b5b79dce4dc793a4b16e78130819c53aa00189
Title: ttk -justify widget option is ignored since 9.1b1
Type: Bug Version: 9.1b1
Submitter: serhiy.storchaka Created on: 2026-09-28 21:05:47
Subsystem: 88. Themed Tk Assigned To: jan.nijtmans
Priority: 5 Medium Severity: Minor
Status: Closed Last Modified: 2026-09-30 15:59:57
Resolution: Fixed Closed By: jan.nijtmans
    Closed on: 2026-09-30 15:59:57
Description:

Since [10da0910f8] and [11d33ca799] the -justify option of ttk::label, ttk::button, ttk::checkbutton, ttk::radiobutton and ttk::menubutton has no effect:

pack [ttk::label .l -text "Hello\nlonger line" -justify center]
pack [ttk::button .b -text "Hello\nlonger line" -justify center]

Both show the lines left-justified in 9.1b1 and trunk, but centered in 9.0.

The option is now stored only as an int (base.justify, TK_OPTION_ENUM_VAR) without a Tcl_Obj, and ttk passes only widget options with a Tcl_Obj to the elements (BuildOptionMap() in ttkTheme.c). The int is not used anywhere, so the option is ignored and the text element gets -justify only from the style. The existing tests only configure the option or check its default.

User Comments: jan.nijtmans added on 2026-09-30 15:59:57:

Since the fix is in trunk now (although it didn't make 9.1.0), this can be closed.


jan.nijtmans added on 2026-09-29 10:23:28:

Yes, I would recommend to cherrypick this to the release branch


oehhar added on 2026-09-29 09:04:17:

Would that be a candidate for 9.1.0 or do we just list the known regression in the release notes. Personally, I think this is a major issue as -justify is widely used.

Thanks for all, Harald


jan.nijtmans added on 2026-09-29 07:48:28:

Fixed [27c0b4ad621740cd|here]

Thanks for the report, the fix, and the testcase!


serhiy.storchaka added on 2026-09-29 07:46:22:

Thanks for the fix! The branch ttk-justify-option also has a manual test ttk-1.5 (constraint userInteraction) for all three values of -justify of ttk::label, ttk::button and ttk::progressbar, set by the widget option and by the style. The existing tests did not catch this regression because they only check the option value.

Should it be merged?


bohagan added on 2026-09-29 06:49:02:
Treeview -selecttype was changed since the value is now also used internally, not just by the bindings. So storage as a C type is necessary.

The justify changes come from the aba849-followup branch. Jan was fixing the default value issue.

serhiy.storchaka added on 2026-09-28 21:20:15:

The same happened with -justify of ttk::progressbar. No other ttk options lost their Tcl_Obj since 9.0, except -selecttype of ttk::treeview, which is only used internally.

Added to the branch.