TabWidget (hwx.gui)#

class TabWidget(**kwds)#

Bases: Widget

NoteBook with tabs.

A NoteBook presents multiple mutually exclusive panes of content in the same area. It includes a tabbed control area with ‘text’ and a content area.

Attribute Table#

Name

Type

command

property

current

property

flat

property

Method Table#

Name

Description

addTab (self, child, text=’’, icon=None)

Inserts a new tab with the specified child.

insertTab (self, child, text=’’, icon=None, index=-1)

Inserts a new tab with the specified child.

Example

from hwx import gui

# This method is called whenever a new Tab is selected.
def tabChanged(event):
# Get the label for the current tab
notebook = event.widget
label = notebook.TabLabel(notebook.current)

# Create NoteBook widget and populate it with some Tabs
notebook = gui.NoteBook(flat=False, command=tabChanged, )

notebook.addTab(gui.LineEdit("First"), text="First")
notebook.addTab(gui.LineEdit("Second"), text="Second")
notebook.addTab(gui.LineEdit("Third"), text="Third")

show(notebook)
property current#

The current tab.

property flat#

Gives the TabWidget a borderless appearance.

property command#

The method called when a the tab changes.

addTab(child, text='', icon=None)#

Inserts a new tab with the specified child.

Parameters:
  • child (Widget) – The widget to be added to the tab.

  • text (str) – The text to be displayed on the tab.

  • icon (str) – The icon to be shown in the tab.

insertTab(child, text='', icon=None, index=-1)#

Inserts a new tab with the specified child.

Parameters:
  • child (Widget) – The widget to be added to the tab.

  • text (str) – The text to be displayed on the tab.

  • icon (str) – The icon to be shown in the tab.

  • index (int) – The index where to insert the tab.