Repository navigation
TabWidget
oldmangan edited this page Oct 6, 2026
·
1 revision
Tabs with badges, closable and disabled tabs, and keep-alive panels.
from wapyt import DataTable, DataTableConfig, TabConfig, TabWidgetConfig
tabs = self.add_tabwidget("main", TabWidgetConfig(
tabs=[TabConfig(id="files", title="Files", icon="mdi-folder"),
TabConfig(id="log", title="Log", badge=3)],
active="files",
))
files = DataTable(DataTableConfig(...), container=tabs.get_cell("files"))
tabs.attach_html("log", "<pre id='log'></pre>")
tabs.on_change(lambda p: refresh(p["id"]))TabConfig(id, title, icon, closable, badge, disabled, html).
TabWidgetConfig(tabs, active, orientation="top" | "left", fill_height=True, keep_alive=True, extra).
-
Mount widgets with
container=tabs.get_cell(tab_id). TabWidget has noadd_*helpers. -
keep_alive=Truekeeps hidden panels mounted. A hidden panel has no size, so re-measure size-sensitive widgets when their tab becomes active, e.g. callterminal.fit()fromon_change. -
TabConfig(html=...)is raw markup; escape any data in it.
| Method | Payload |
|---|---|
on_change |
{id, viaClick} |
on_close |
{id} |
on_ready |
— |
add_tab(tab, index=None), remove_tab, set_active, get_active,
attach_html, attach, set_badge, disable_tab, enable_tab, get_cell.
wapyt is MIT-licensed · Repository · pyTincture · Issues
Getting started
Widgets
- Layout and MainWindow
- Tree
- DataTable
- Form
- ModalWindow
- Window
- TabWidget
- Toolbar
- Sidebar
- Chat
- Terminal
- CardPanel
- ResourceBoard
- File Transfer
- Message
- ContextMenu
- MenuBar
- Listbox
- Kanban
- ProgressBar
- Pagination
- Popup and tooltips
- Chart
- Scheduler
- MediaPlayer
Guides
Planning
Contributing