Re: get default options of Tk widgets



Simon Bachmann schrieb:
Hi

% info patchlevel
8.4.11

My question: is there a way to get the values that are used for options
of Tk widgets when they aren't specified? (the defaults)
Is there a command or a variable that can tell me, for instance, what
background color is used by default for Labels?
The "option get" command isn't what I'm looking for: it works for some
options, it doesn't for others:

% option get . font Label
helvetica -12
% option get . Foreground Label
%

That's what I'm trying to do:
I've got a proc that configures several widgets according to data stored
in arrays/lists.
This works well, now I need to "reset" some options of this widgets to
the default value. The problem is that I cannot know in advance what
options are to be reset, so I can't use hardcoded values...

Here's a simplified example of what I'm looking for

label .l -fg red

set option foreground
.l configure -$option {Here I need the default value...}

Of course I could create an array that contains all values that I need,
but if there's an easier way...

Usually one creates one widget of the appropriate type and uses
configure to read the default values of the options.

Michael
.



Relevant Pages

  • Re: Wiederverwendung bei der GUI-Entwicklung?
    ... Widgets ermöglicht. ... akzeptieren, dass es ausser dem Presenter noch eine "Partei" gibt, die ... public class SomeFileView extends JPanel implements FileView { ... void addFileLabel(JComponent label); ...
    (de.comp.lang.java)
  • Re: Resize question
    ... Depends which column you want to adjust when you adjust the window ... the one with label widgets, or the one with entry widgets ... # set up the scroll region based on ...
    (comp.lang.tcl)
  • get default options of Tk widgets
    ... is there a way to get the values that are used for options of Tk widgets when they aren't specified? ... Foreground Label ... The problem is that I cannot know in advance what options are to be reset, so I can't use hardcoded values... ...
    (comp.lang.tcl)
  • Re: tile label size problem
    ... label widgets adjust their requested size ... you can specify a -width in characters. ... feature that a negative value for -width specifies a minimum ...
    (comp.lang.tcl)