TabView

The TabView is a View subclass which represents Cocoa’s NSTabView. The way it works is that you add tab items to it with TabView.addTab(), which will return a TabViewItem. This tab item has a TabViewItem.view attribute that you can use as a parent for the subviews you want to add with that tab. Of course, like with any subview, the layout process in tab views are made independently of the layout in the tab view’s parent. Example:

tabview = TabView(mywindow)
tab = tabview.addTab("mytab")
label = Label(mytab.view, "label in my tab")

tabview.moveTo(Pack.UpperLeft)
tabview.fill(Pack.Right)
tabview.fill(Pack.Below)
tabview.setAnchor(Pack.UpperLeft, growX=True, growY=True)
label.moveTo(Pack.UpperLeft)
label.fill(Pack.Right)
class TabView(parent)
Parameters:parent – A View instance. Same as View.parent.
tabViewType

Cocoa constant. Determines where the tabs, if any, are located. Use with NSTabViewType constants.

addTab(label[, identifier=None])
Parameters:

Creates a TabViewItem and adds it to self. The created item is returned by the method.

TabViewItem

The TabViewItem is created by TabView.addTab() and represents a NSTabViewItem. You shouldn’t create it directly, but you can set its attributes (except TabViewItem.view which is read-only).

class TabViewItem(tabview, label[, identifier=None])
Parameters:
label

String. The label of the tab item. Equivalent to [self label].

identifier

String. The identifier of the tab item. Equivalent to [self identifier].

view

View. Read-Only. The view associated with the tab. Use this as a parent to the widgets you want to place in the tab.

In Cocoa, it’s possible to set your own view with [NSTabViewItem setView:], but there are technical difficulties in xibless making this impossible for the moment.

Table Of Contents

Previous topic

ImageView

Next topic

TableView

This Page