tk/option

The tk/option command allows you to add entries to the Tk option database or to retrieve options from the database.

(tk/option 'add pattern value ?priority?)
adds a new option to the database. Pattern contains the option being specified, and consists of names and/or classes separated by asterisks or dots, in the usual X format. Value contains a text string to associate with pattern; this is the value that will be returned in calls to Tk_GetOption or by invocations of the tk/option get command. If priority is specified, it indicates the priority level for this option (see below for legal values); it defaults to interactive.
(tk/option 'clear)
clears the option database. Default options (from the RESOURCE_MANAGER property or the .Xdefaults file) will be reloaded automatically the next time an option is added to the database or removed from it.
(tk/option 'get window name class)
returns the value of the option specified for window under name and class. If several entries in the option database match window, name, and class, then the command returns whichever was created with highest priority level. If there are several matching entries at the same priority level, then it returns whichever entry was most recently entered into the option database. If there are no matching entries, then the empty string is returned.
(tk/option 'readfile fileName ?priority?)
reads fileName, which should have the standard format for an X resource database such as .Xdefaults, and adds all the options specified in that file to the option database. If priority is specified, it indicates the priority level at which to enter the options; priority defaults to interactive.

The priority arguments to the tk/option command are normally specified symbolically using one of the following values:

widgetDefault
Level 20. Used for default values hard-coded into widgets.
startupFile
Level 40. Used for options specified in application-specific startup files.
userDefault
Level 60. Used for options specified in user-specific defaults files, such as .Xdefaults, resource databases loaded into the X server, or user-specific startup files.
interactive
Level 80. Used for options specified interactively after the application starts running. If priority isn't specified, it defaults to this level.

In addition, priorities may be specified numerically using integers between 0 and 100, inclusive.


Corresponding Tcl/Tk command:

option ...

© Author | Home | Sitemap