Tk Source Code

View Ticket
Login
Ticket UUID: 220931
Title: option get command responding to invalid input
Type: Bug Version: obsolete: 8.3
Submitter: welch Created on: 2000-11-01 01:31:27
Subsystem: 57. [option] Assigned To: aku
Priority: 3 Low Severity: Minor
Status: Closed Last Modified: 2026-10-25 11:53:30
Resolution: Fixed Closed By: nemethi
    Closed on: 2026-10-25 11:53:30
Description:
OriginalBugID: 5957 Bug
Version: 8.3
SubmitDate: '2000-06-27'
LastModified: 
Severity: MED
Status: UnAssn
Submitter: techsupp
OS: Windows NT
Machine: Dell OptiPlex GX1


Name:
Allen Flick

ReproducibleScript:
Within ~/.Xdefaults.....                      *Button.background: cyan
then within Wish Console

% pack [button .b -text Button]
% option get .b background Button
cyan
% option get .b background Width
cyan
% option get .b background Relief
cyan
% pack [button .b -text Button]
% option get .b background Button
cyan
% option get .b background Label
cyan
% option get .b background Text
cyan

ObservedBehavior:
No matter what is put in for "class" of option database value, the response is only for the "name"
of the option database value.

DesiredBehavior:
If the "name" option with the given "class" does not exist, I'd expect to get an
empty string as the response.  Or some error code & message.
User Comments: nemethi (claiming to be Csaba Nemethi) added on 2026-10-25 11:53:30:

Serhiy, many thanks for the documentation fix! Merged into main, core-9-0-branch, and core-8-6-branch by commits [0a7003b0], [b9ea3c8a], and [5e360f9f].


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

The behavior is correct and the same in 9.1: an entry matches if the last word of its pattern is either the name or the class, the other one is not checked. But the documentation said that the entry should match both the name and the class.

Proposed documentation fix in branch doc-option-get-class.


dkf added on 2000-11-20 17:37:55:
It is part of the defined behaviour of options under X that option names are always preferred to option classes.  Tk implements exactly this, so the behaviour you describe is correct, if surprising.  Perhaps a documentation change would be useful, but certainly not a code change.