Mod /
Gui Ref
Search:  


1.  Gui Reference

Option reference for Gui layout elements.

1.1  Gui Options

Option for the gui command

OptionDefaultDescriptionArgs
autonameTrueAuto name items using lower case of command
command Callback handler-type {cmd guiobj id optpairs}
file File to read value for -gui from
frame The parent frame to layout within
gui The gui layout
icfg Internal config
object TOD object (ie. -variable and -command are the same)
parent The parent window of this layout
prefix String to add to begining of variables v,/w,
values Set of name/value pairs to initialize id's with
variable Variable to set v,/w etc in

1.2  Widget Elements

Following are the gui element tags that create widget windows

ElementDescription
BarchartThe blt barchart widget
BargraphThe blt bargraph widget.
ButtonThe Tk button widget
CanvasThe Tk canvas widget
Canvas3dThe 3d canvas extension (requires the Canvas3d extension).
CheckbuttonThe Tk checkbutton widget
ContainerThe blt container widget
DialThe vu dial widget.
EntryThe Tk entry widget
FrameThe Tk frame widget
GraphThe blt graph widget
GridableRender a table using grid (warning this is a tcl-extension).
HtextThe blt container widget
LabelThe Tk label widget
LabelframeThe Tk labelframe widget
ListboxThe Tk listbox widget
MenubuttonThe Tk menubutton widget
MessageThe Tk message widget
NotetabRender a notetab using buttons (warning this is a tcl-extension).
PanedwindowThe Tk panedwindow widget
PieThe vu bargraph widget.
RadiobuttonThe Tk radiobutton widget
ScaleThe Tk scale widget
ScrollbarThe Tk scrollbar widget
SpinboxA spinbox entry widget
StripchartThe blt stripchart widget
TableThe tktable widget.
TabsetThe blt tabset widget
TabularRender a table inside a Tk text widget (warning this is a tcl-extension).
TextThe Tk text widget
ToplevelThe Tk toplevel widget
TreeViewThe blt treeview widget
TreeCtrlA complex tree widget
gridLayout rows of elements.
statusbarCreate a statusbar at the bottom of the toplevel.
tkEval inline tcl/tk code after substituting %W and %_.

Gui also supports the Ttk widgets:

ElementDescription
TButtonThe Tk button widget
TCheckbuttonThe Tk checkbutton widget
TFrameThe Tk frame widget
TLabelThe Tk label widget
TLabelframeThe Tk labelframe widget
TMenubuttonThe Tk menubutton widget
TPanedwindowThe Tk panedwindow widget
TRadiobuttonThe Tk radiobutton widget
TScaleThe Tk scale widget
TScrollbarThe Tk scrollbar widget
TSpinboxA spinbox entry widget
TProgressbarThe progressbar widget
TComboboxThe combobox widget.
TNotebookThe blt tabset widget
TSizegripSize griper.
TSeparatorThe separator widget
TreeviewThe treeview widget

1.3  Non-Widget Elements

Following are the non-window gui element tags

ElementDescription
MenuLayout a menu (note uses "Menu attributes") .
configureConfigure a gui option.
includeInclude a file and process as a gui.
styleSet style to use for toplevel.
wmEval the tk [wm] command.

1.4  Sub-elements (Items)

Some elements take sub-items. Here are just a few:

Sub-ElementDescription
rowA row in a grid
tabA tab in a tabset/notebook
paneA pane in a panedwindow
xLeave an empty cell in a grid or command in a Menu.

1.5  Element Attributes

General attribute options available for most layout elements. Note, use the Guild user interface to find the exact attributes available for a tag.

OptionDefaultDescriptionArgs
# A comment attribute
-cbopts Exta options to include in callback -x option (eg. % bind)
-conf Configuration options passed directly to widgets at creation.-label {Widget Options}
-default Default string to initialize widgets data variable with.-label Initializer
-dynamic0Defer layout until child-window is mapped (for frame, tabset, etc). 2 means relayout every time window is mapped
-focusFalseRequest focus at end of layout
-hideFalseCreated item is initially hidden
-gid Group identifier for use with style
-id Identifier for use by style and variable name
-init An init msg to call, results are used to set label
-key One or more keyboard shortcuts to invoke msg for widget
-label Text label for shortform displays
-matte Make the containing frame appear matted (raised and inset)
-mcTrueDo msgcat 'mc' translation (eg. buttons, listbox items, etc)
-msg Messsage to generate (ie. for bind, -command, etc)
-name Name of item to override 'id' for item variable eg. for radiobutton
-pad0,0,0,0Padding for pack (1 to 4 values: x,y external then x,y internal).
-pos Positioning of widget. One or more of letters in 'newsltbr|_+@X,y#W,H'
-posopts Options to pass directly to position manager pack/place/grid
-scroll Scrollbar positions. eg: 'ne', 'sw' and 'w*'
-style Style to apply
-subattr Arguments for all child widgets to inherit
-subconf Conf for all child widgets to inherit
-subgid Make all child widgets members of group
-subpos Positioning for child widgets (eg of frame, grid, etc)
-tip A tooltip or balloon string
-useid Use body from element with given id
-value Value for item

1.6  Menu Element Attributes

Attribute for the "Menu" element. OBSOLETE

OptionDefaultDescriptionArgs
A The -accelerator option, ie. do not use bind.
K Key string for the -accelerator, binding to toplevel.
a Arguments to append after the nscmd.
c Command to return dynamic menu options.
d Data variable containing menu options.
f Font to use for menu item.
g Image file to use as -compound (if Tk > 8.3).
h Image file to use instead of text.
i Inherited attrs for child menu elements.
k Key string for the -accelerator option.
l Label to use.
m The menu for a cascade.
n Namespace in which to handle msg
o Raw menu option string to inline.
p For menus, msg to invoke on each post.
s Subcommand to override the menu string.
u Explicit value for the -underline option.
v Variable for the -variable option.
wnAppend the window path to callback.
x1Label should use msgcat.

1.7  Pos Options

General options for the "pos" and "subpos" attributes. Mostly these are used with the default pack/place managers.

OptionTranslationDescription
¡-expand yExpand to fill available space
# Option for setting width width,height eg: #200,400 or #0.3,0.3
*-fill both -expand yFill all space and expand. Same as +¡
+-fill bothFill both vertically and horizontally
 A toplevel menu
@ Use 'place' with absolute or relative. eg: @200,400 or @0.1,0.2
^ A pop-up menu or programatically placed window
_-fill xFill horizontally
|-fill yFill vertically
b-side bottomPack against bottom
l-side leftPack against right
r-side rightPack against left
t-side topPack against top
n-anchor nAnchor against top
e-anchor eAnchor against left
s-anchor sAnchor against bottom
w-anchor wAnchor against right

1.8  Grid-Pos Options

Options for "pos" when used within the "grid" element.

OptionTranslationDescription
|nsSticky top/bottom
_ewSticky left/right
*newsSticky in all directions and expand
¡ Expand to fill available space
ccCentered spacing in available space
tnSticky top
bsSticky bottom
reSticky right
lwSticky left
nnAnchor at north
ssAnchor at south
eeAnchor at east
wwAnchor at west
# Option for setting width,height eg: #200,400

1.9  Event Options

Event elements that are passed in opts parameter to event handler.

OptionTranslationDescription
args Arguments
button%bThe mouse button number substitution
cmd The item command name from layout
coords%X,%YThe root window x,y coordinates of event
default User data to include with event (from layout default)
extra Extra % substitutions to include (from layout cbopts)
groups The value of -parent
id The user assigned item name (ie. the layout id)
init Unique layout item index
key%AThe unicode character substitution
keysym%KThe key symbol substitution (eg 'Return')
label The label (eg. for buttons)
tod Gui object or value of _
path The path. eg. 'menu/File/Open'
pcmd The parent command item to this item
pclass The Tk class of pcmd
tkwin%WThe Tk window substitution
value Value part from name/value of gui layout
win The gui window that received event

1.10  Scroll Options

Options for "scroll" attribute which controls the position of scrollbars

OptionDescription
eRight scrollbar
nTop scrollbar
*Automatically create destroy scrollbars as needed
wLeft scrollbar
sBottom scrollbar
+Bind alt-pageup/pagedown/end to dynamically change scrollbars
#For scrollframe (text widget in a canvas), adjust size of text widget

© 2008 Peter MacDonald

Page last modified on September 21, 2010, at 10:21 AM