Name

tabset

tabset pathName [option value...]

The tabset command creates a new tabset widget named pathName. A tabset widget displays a a series of overlapping widget layout folders. Only the contents of one folder, selected by using its tab, is displayed at one time. The tabset widget is similar to the notebook mega-widget in the Tix extension.

Standard Options

-activebackground

-activeforeground

-background

-borderwidth

-cursor

-font

-foreground

-highlightbackground

-highlightcolor

-highlightthickness

-relief

-selectbackground

-selectborderwidth

-selectforeground

-takefocus

Widget-Specific Options

-dashes dashStyle (dashes, Dashes)

Dash style for focus outline around selected tab’s label. Parameter dashStyle is a list of up to 11 numbers that alternately represent the lengths of the dashes and gaps. Each number must be between 1 and 255, inclusive. If dashStyle is the empty string, a solid line is drawn. The default is {5 2}.

-gap size (gap, Gap)

Gap, in pixels, between tabs. The default is 2.

-height height (height, Height)

Desired height, in screen units, for the window. If height is 0 (the default), the height is autosized.

-pageheight height (pageHeight, PageHeight)

Desired height, in screen units, for the area under the tabs for displaying the page contents. If height is 0 (the default), the height is autosized.

-pagewidth width (pageWidth, PageWidth)

Desired width, in screen units, for the area under the tabs for displaying the page contents. If width is 0 (the default), the width is autosized.

-rotate theta (rotate, Rotate)

Rotate the text in tab labels by theta degrees.

-samewidth boolean (sameWidth, SameWidth)

Whether each tab should be the same width. If true, each tab will be as wide as the widest tab. The default is false.

-scrollcommand cmdPrefix (scrollCommand, ScrollCommand)

Prefix for a command used to communicate with an associated scrollbar used to scroll through available tabs. Typically scrollbar set, where scrollbar is the pathname of a scrollbar widget.

-scrollincrement amount (scrollIncrement, ScrollIncrement)

Increment, in pixels, for scrolling by units (see view method).

-selectcommand command (selectCommand, SelectCommand)

Default command to be evaluated when a tab is invoked. See the invoke method.

-selectpad amount (selectPad, SelectPad)

Padding to be added around the selected tab. The default is 5.

-shadowcolor color (shadowColor, ShadowColor)

Color of shadow around pages.

-side side (side, Side)

The side of the tabset on which the tabs should be displayed. Side must be left, right, top (the default), or bottom.

-tabbackground color (tabBackground, Background)

Default background color for tabs.

-tabborderwidth amount (tabBorderWidth, BorderWidth)

Width of 3D border drawn around tabs.

-tabforeground color (tabForeground, Foreground)

Default foreground color for tabs.

-tabrelief relief (tabRelief, TabRelief)

3D effect desired for the border around tabs.

-textside side (textSide, TextSide)

Specify on which side of a tab its text label is placed if both images and text are displayed in a tab. Side must be left, right, top (the default), or bottom.

-tiers number (tiers, Tiers)

Maximum number of tiers to use for displaying tabs. Default is 1.

-tile imageName (tile, Tile)

Image to use as a tile for the background of the tabset.

-width amount (width, Width)

Desired width, in screen units, for the window. If amount is 0 (the default), the width is autosized.

Tab Indices

Several tabset widget methods support a tabIndex argument that identifies a specific tab in the tabset. This index can take one of the following forms:

number

The number th tab in the tabset.

tabName

The tab named tabName.

@x, y

The tab that covers the pixel whose coordinates within the tabset window are x and y.

tabSelect

Tab whose page is currently selected and displayed.

tabActive

Tab that is currently active. Typically, the tab with the mouse pointer over it.

tabFocus

Tab that currently has the widget’s focus.

tabDown

Tab immediately below the tab that currently has the focus, if there is one.

tabLeft

Tab immediately left of the tab that currently has the focus, if there is one.

tabRight

Tab immediately right of the tab that currently has the focus, if there is one.

tabUp

Tab immediately above the tab that currently has the focus, if there is one.

tabEnd

Last tab in the tabset.

Methods

pathName activate tabIndex

Make the tab tabIndex the active tab. If tabIndex is the empty string, no tab will be active.

pathName bind tagName [sequence [command] ]

Bind command to all tabs with tag tagName so it is invoked when the given event sequence occurs for the tab. The syntax for this method is the same as for the standard Tk bind command except that it operates on tabs. TagName may be the name of a tab, the special tag all (bind to all tabs), or an arbitrary string. Only keyboard and mouse events can be bound.

pathName delete first [last]

Delete the range of tabs from first to last, inclusive. If last is omitted, then only the tab first is deleted.

pathName focus tabIndex

Make tab tabIndex the current focus tab.

pathName get tabIndex

Return the numeric index of the tab identified by tabIndex.

pathName insert position tabName [option value...] [tabName [option value...] ]...

Create one or more new tabs with names specified by the tabName arguments and configured with the following options. The tabs are inserted just before the tab position. If position is the special tag end, the tab is added to the end of the tab list. TabName should be chosen not to conflict with any of the special index strings. The following tab configuration options are available:

-activebackground color (activeBackground, ActiveBackground)

Background color for tab when it is active.

-activeforeground color (activeForeground, ActiveForeground)

Foreground color for tab when it is active.

-anchor anchorPos (anchor, Anchor)

Anchor point for placing the tab’s embedded widget inside the tab’s page. The default is center.

-background color (background, Background)

Background color for the tab. Overrides the -tabbackground option of the widget.

-bindtags tagList (bindTags, BindTags)

The binding tag list for the tab, which determines the order of evaluation of the commands for matching event bindings. Implicitly, the name of the tab itself is always the first tag in the list. The default value is all.

-command command (command, Command)

Command to be evaluated when the tab is invoked. Overrides the widget’s -selectcommand option.

-data string (data, Data)

Arbitrary data string to associate with the tab.

-fill fill (fill, Fill)

How the tab’s embedded widget should be stretched when its requested size is smaller than the size of tab’s page. Fill must be one of x, y, both, or none (the default).

-font font (font, Font)

Font to use for the tab’s text label.

-foreground color (foreground, Foreground)

Foreground color for the tab. Overrides the widget’s -tabforeground option.

-image imageName (image, Image)

Image to be drawn in the tab’s label.

-ipadx amount (iPadX, PadX)

Horizontal padding to the left and right of the tab’s label. If amount has two elements, the first specifies the padding for the left side and the second for the right.

-ipady amount (iPadY, PadY)

Vertical padding to the top and bottom of the tab’s label. If amount has two elements, the first specifies the padding for the left side and the second for the right.

-padx amount (padX, PadX)

Horizontal padding to the left and right of the tab’s embedded widget. If amount has two elements, the first specifies the padding for the left side and the second for the right.

-pady amount (padY, PadY)

Vertical padding to the top and bottom of the tab’s embedded widget. If amount has two elements, the first specifies the padding for the left side and the second for the right.

-selectbackground color (selectBackground, Background)

Background color for tab when it is selected. Overrides the widget’s -selectbackground option.

-shadow color (shadow, Shadow)

Color for the shadow under the tab’s text label. The default is the empty string (i.e., transparent).

-state state (state, State)

State for the tab. State must be normal or disabled.

-stipple bitmap (stipple, Stipple)

Stipple pattern to use for the background of the page window when tab’s embedded window is torn off. The default is BLT.

-text string (text, Text)

Text for the tab’s text label.

-window pathName (window, Window)

Name of widget to be embedded into tab’s page. It must be a child of the tabset. The tabset will “pack” and manage the size and placement of the widget.

-windowheight height (windowHeight, WindowHeight)

Desired height, in screen units, for the tab’s page. If height is 0 (the default), the height is set to the maximum height of all embedded tab widgets.

-windowwidth width (windowWidth, WindowWidth)

Desired width, in screen units, for the tab’s page. If width is 0 (the default), the width is set to the maximum width of all embedded tab widgets.

pathName invoke tabIndex

Select the tab tabIndex, map the tab’s embedded widget, and execute any associated command. The Return value will be the Return value of the command if there is one, an empty string otherwise. This command does nothing if the tab’s state is disabled. The following substitutions are made to the command before it is evaluated:

%%

An actual percent sign

%W

Pathname of tabset widget

%i

Numeric index of invoked tab

%n

Name of invoked tab

pathName move tabIndex where position

Move the tab tabIndex to a position immediately before or after the tab position. Where must be either before or after.

pathName nearest x y

Return the name of the tab nearest to screen coordinates x y.

pathName scan dragto x y

Scroll the widget’s view horizontally and vertically. The distance scrolled is equal to 10 times the difference between this command’s x and y arguments and the x and y arguments to the last scan mark command for the widget.

pathName scan mark x y

Record the screen coordinates x y as anchors for a following scandragto method call.

pathName see tabIndex

Scroll the tabset so that tab tabIndex is visible.

pathName size

Return the number of tabs in the tabset.

pathName tab cget tabIndex option

Return the current value of configuration option option for tab tabIndex.

pathName tab configure tabIndex [tabIndex...] [option value...]

Query or modify the configuration options for the tabs identified by the tabIndex arguments in the same manner as the general widget configure method. Supported options are those available for the insert method.

pathName tab names [pattern]

Return the names of all tabs in the tabset. If pattern is given, only tab names matching the pattern are returned.

pathName tab tearoff tabIndex [newName]

Reparent the embedded widget belonging to tab tabIndex inside of newName. If newName is the pathname of the tabset widget itself, the embedded widget is put back into its page. Otherwise, the widget new-Name must not already exist. If no newName argument is given, the current parent of the embedded widget is Returned. An empty string is Returned if there is no embedded widget for tab tabIndex.

pathName view

Return a two-element list describing the currently visible region of the tabset. The elements are the fractional distances of the view’s left and right (or bottom and top) edges into the span of the widget’s width (or height).

pathName view moveto fraction

Adjust the visible region of the tabset so that the point indicated by fraction along the widget’s span appears at the region’s left (or top) edge.

pathName view scroll number what

Shift the visible region of the tabset by number. If what is units, then number is in units of the -scrollincrement option. If what is pages, then number is in number of tabs.

Example

image create photo stopImg -file images/stopsign.gif
image create photo rainImg -file images/rain.gif
tabset .t
.t insert end t0 -text Stop -window [label .t.l0 -image stopImg]
.t insert end t1 -text Rain -window [label .t.l1 -image rainImg]
pack .t
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset