Tk Source Code

View Ticket
Login
Ticket UUID: 3f5867c997a98d045bd656439a218c78ab4053a1
Title: Inconsistency between grid info, place info and pack info
Type: Bug Version: core-8-6-branch
Submitter: fvogel Created on: 2024-09-29 20:24:22
Subsystem: 49. [grid] Assigned To: jan.nijtmans
Priority: 5 Medium Severity: Minor
Status: Closed Last Modified: 2026-11-03 08:24:14
Resolution: Fixed Closed By: oehhar
    Closed on: 2026-11-03 08:24:14
Description:

With an un-gridded, un-placed, un-packed window, [grid info] and [place info] return "" but [pack info] returns an error:

% package require Tk
8.6.9
% frame .f
.f
% grid info .f
% place info .f
% pack info .f
window ".f" isn't packed
%

This looks inconsistent.

Note that this inconsistency is enforced in the test suite:

  • the behavior of [pack info] in this case is tested by pack-17.2 (an error is the expected result)
  • the behavior of [grid info] in this case is tested by grid-5.4 (the empty string is the expected result)
  • the behavior of [place info] in this case is not tested

User Comments: oehhar added on 2026-11-03 08:24:14:

Great. As complementary info to this ticket: all three cases now return the empty string. This is now documented.

Thanks to the team! Harald


nemethi (claiming to be Csaba Nemethi) added on 2026-11-02 17:49:19:

Many thanks to Jan for the fix and to Serhiy for the review! Merged to main by commit [ebe87fbf]. Removed the unfinished sentence from doc/place.n and added a test for the case "content without a container", as suggested by Serhiy.

Due to the change in the functionality of pack, no backport to core-9-0-branch or core-8-6-branch is planned.


serhiy.storchaka added on 2026-09-28 12:51:56:

Returning an empty string from grid info and place info for an unmanaged window was not documented, so an alternative solution to make all three commands return an error should also be considered. Either way it is an incompatible change, which I would not backport to 8.6 and 9.0.

Review of the branch:

  • doc/place.n: an unfinished sentence "If the " is left after the new text.
  • place-9.13 tests a window that was never placed, which already returned an empty string. The new case in place info (content without a container) is not tested.


jan.nijtmans added on 2026-09-28 11:36:58:

Proposed fix [320e533d8dba4c6a|here]

Anyone who would like to review?