Tk - Widget per notebook

Un widget a schede che aiuta a passare da una pagina all'altra, utilizzando una scheda indice. La sintassi per il widget notebook è mostrata di seguito.

ttk::notebook notebookName options

Opzioni

Le opzioni disponibili per il widget Blocco note sono elencate di seguito nella tabella seguente:

Sr.No. Sintassi e descrizione
1

-height number

Utilizzato per impostare l'altezza del widget.

2

-width number

Imposta la larghezza per il widget.

Di seguito è mostrato un semplice esempio per il widget del notebook:

#!/usr/bin/wish

ttk::notebook .n  -width 100 -height 100
ttk::frame .n.f1; 
ttk::frame .n.f2; 
.n add .n.f1 -text "TabOne" 
.n add .n.f2 -text "TabTwo"
pack [label .n.f1.f2 -background red -foreground white -text "TabOne"]
pack [label .n.f2.f2 -background red -foreground white -text "TabTwo"]
pack .n

Quando eseguiamo il programma sopra, otterremo il seguente output: