**SYNOPSIS** instance = ttk.'''Notebook('''parent [,**options]''')''' <
> instance'''.add('''child [,**options]''')''' <
> instance'''.insert('''pos ,subwindow ,**options''')''' **DESCRIPTION** A '''ttk.Notebook''' widget manages a collection of windows and displays a single one at a time. Each slave window is associated with a ''tab'', which the user may select to change the currently-displayed window. **STANDARD OPTIONS** class <
> cursor <
> style <
> takefocus <
> **WIDGET-SPECIFIC OPTIONS** '''height''' <
> If present and greater than zero, specifies the desired height of the pane area (not including internal padding or tabs). Otherwise, the maximum height of all panes is used. '''padding''' <
> Specifies the amount of extra space to add around the outside of the notebook. The padding is a list of up to four length specifications ''left'' ''top'' ''right'' ''bottom''. If fewer than four elements are specified, ''bottom '' defaults to ''top'', ''right'' defaults to ''left'', and ''top'' defaults to ''left''. In other words, a list of three numbers specify the left, vertical, and right padding; a list of two numbers specify the horizontal and the vertical padding; a single number specifies the same padding all the way around the widget. '''width''' <
> If present and greater than zero, specifies the desired width of the pane area (not including internal padding). Otherwise, the maximum width of all panes is used. **TAB OPTIONS** The following options may be specified for individual notebook panes: '''state''' <
> Either '''"normal"''', '''"disabled"''' or '''"hidden"'''. If '''"disabled"''', then the tab is not selectable. If '''"hidden"''', then the tab is not shown. '''sticky''' <
> Specifies how the slave window is positioned within the pane area. Value is a string containing zero or more of the characters '''"n"''', '''"s"''', '''"e"''', or '''"w"'''. Each letter refers to a side (north, south, east, or west) that the slave window will "stick" to, as per the '''grid()''' geometry manager. '''padding''' <
> Specifies the amount of extra space to add between the notebook and this pane. Syntax is the same as for the widget '''padding''' option. '''text''' <
> Specifies a string to be displayed in the tab. '''image''' <
> Specifies an image to display in the tab. See ''ttk.Widget()'' for details. '''compound''' <
> Specifies how to display the image relative to the text, in the case both '''text''' and '''image''' are present. See ''tkinter.Label'' class for legal values. '''underline''' <
> Specifies the integer index (0-based) of a character to underline in the text string. The underlined character is used for mnemonic activation if '''enable_traversal()''' method is called. **TAB IDENTIFIERS** The ''tabid'' argument to the following commands may take any of the following forms: An integer between zero and the number of tabs; The name of a child window; A positional specification of the form ''"@x,y"'', which identifies the tab The literal string '''current''', which identifies the currently-selected tab; or: The literal string '''end''', which returns the number of tabs (only valid for '''index()''' method). **WIDGET METHODS** instance'''.add('''child [,**options]''')''' <
> Adds a new tab to the notebook. See '''TAB OPTIONS''' for the list of available ''options''. If ''window '' is currently managed by the notebook but hidden, it is restored to its previous position. instance'''.cget('''"option"''')''' <
> Returns the current value of the configuration option given by option. Option may have any of the values accepted by the '''Notebook''' class. instance'''.configure()''' <
> instance'''.configure('''"option"''')''' <
> instance'''.configure('''**options''')''' <
> Query or modify the configuration options of the widget. <
> If no option is specified, returns a list describing all of the available options for instance: the elements of the list are the option name, database name, database class, default value, and current value. <
> If "option" is specified, then the method returns a list describing the one named option (this list will be identical to the corresponding sublist of the value returned if no option is specified). <
> If **options are specified, then the command modifies the given widget option(s) to have the given value(s); in this case the method returns an empty string. Option may have any of the values accepted by the '''Notebook''' class. instance'''.forget('''tabid''')''' <
> Removes the tab specified by ''tabid'', unmaps and unmanages the associated window. instance'''.hide('''tabid''')''' <
> Hides the tab specified by ''tabid''. The tab will not be displayed, but the associated window remains managed by the notebook and its configuration remembered. Hidden tabs may be restored with the '''add()''' method. instance'''.index('''tabid''')''' <
> Returns the numeric index of the tab specified by ''tabid'', or the total number of tabs if ''tabid'' is the string '''"end"'''. instance'''.insert('''pos ,subwindow ,**options''')''' <
> Inserts a pane at the specified position. ''pos'' is either the string '''end''', an integer index, or the name of a managed subwindow. If ''subwindow is'' already managed by the notebook, moves it to the specified position. See '''TAB OPTIONS''' for the list of available options. instance'''.state('''[**statespec] [,callback ,*args ,**kwargs]''')''' <
> See ttk.Widget(). Instance'''.select('''[''tabid'']''')''' <
> Selects the specified tab. The associated child window will be displayed, and the previously-selected window (if different) is unmapped. If ''tabid'' is omitted, returns the widget name of the currently selected pane. instance'''.state('''[*statespac]''')''' <
> See ttk.Widget(). instance'''.tab('''tabid''')''' <
> instance'''.tab('''tabid ,option''')''' <
> instance'''.tab('''tabid ,**options''')''' <
> Query or modify the options of the specific tab. <
> If no ''option'' is specified, returns a dictionary of the tab option values. <
> If one ''option'' is specified, returns the value of that ''option''. <
> Otherwise, sets the ''**options'' to the corresponding ''values''. See TAB OPTIONS for the available options. instance'''.tabs()''' <
> Returns the list of windows managed by the notebook, in the index order of their associated tabs. **KEYBOARD TRAVERSAL** To enable keyboard traversal for a toplevel window containing a notebook widget ''nb'', call: <
> nb'''.enable_traversal()''' This will extend the bindings for the toplevel window containing the notebook as follows: <
> '''Control-Tab''' selects the tab following the currently selected one. <
> '''Control-Shift-Tab''' selects the tab preceding the currently selected one. <
> '''Alt-'''''K'', where ''K'' is the mnemonic (underlined) character of any tab, will select that tab. <
> Multiple notebooks in a single toplevel may be enabled for traversal, including nested notebooks. However, notebook traversal only works properly if all panes are direct children of the notebook. **VIRTUAL EVENTS** The notebook widget generates a '''<>''' virtual event after a new tab is selected. **EXAMPLE** ====== #import tkinter and ttk modules import tkinter from tkinter import ttk #Make the root widget root = tkinter.Tk() #Make the notebook nb = ttk.Notebook(root) nb.pack() #Make 1st tab f1 = tkinter.Frame(nb) #Add the tab nb.add(f1, text="First tab") #Make 2nd tab f2 = tkinter.Frame(nb) #Add 2nd tab nb.add(f2, text="Second tab") nb.select(f2) nb.enable_traversal() #Enter the mainloop root.mainloop() ====== [notebook exemple]