'Constructor arguments:
select_command -- A callable which will be called when a tab is
selected. It is called with the name of the selected tab as an
argument.
tabs -- A list of strings, the names of the tabs. Should be specified in
the desired tab order. The first tab will be the default and first
active tab. If tabs is None or empty, the TabSet will be initialized
empty.
n_rows -- Number of rows of tabs to be shown. If n_rows <= 0 or is
None, then the number of rows will be decided by TabSet. See
_arrange_tabs() for details.
max_tabs_per_row -- Used for deciding how many rows of tabs are needed,
when the number of rows is not constant. See _arrange_tabs() for
details.'

def __init__(self, page_set, select_command, tabs=None, n_rows=1, max_tabs_per_row=5, expand_tabs=False, **kw):

    Frame.__init__(self, page_set, **kw)
    self.select_command = select_command
    self.n_rows = n_rows
    self.max_tabs_per_row = max_tabs_per_row
    self.expand_tabs = expand_tabs
    self.page_set = page_set
    self._tabs = {}
    self._tab2row = {}
    if tabs:
        self._tab_names = list(tabs)
    else:
        self._tab_names = []
    self._selected_tab = None
    self._tab_rows = []
    self.padding_frame = Frame(self, height=2, borderwidth=0, relief=FLAT, background=self.cget('background'))
    self.padding_frame.pack(side=TOP, fill=X, expand=False)
    self._arrange_tabs()
