Tk Source Code

Artifact [76dd6ad2]
Login

Artifact 76dd6ad2517e987cda9e293d2dd9881b58b2c106:

Attachment "qt.tcl" to ticket [2912962f] added by decosterjos 2009-12-12 05:08:19.
package require Tk
package require ttk::theme::tileqt
ttk::style theme use tileqt

proc build_pref {} {
    set nb [ttk::notebook .nb]
    grid $nb
#    set tab0 [ttk::frame $nb.tab0]
#    $nb add $tab0 -text "Tab NULL" -padding 2

    grid [ttk::button .b0 -text "Set 0" -command [list opt0 $nb]]
    grid [ttk::button .b1 -text "Set 1" -command [list opt1 $nb]]
}

proc opt0 {nb} {
    foreach tab [lrange [$nb tabs] 0 end] {
	$nb hide $tab
    }
    if {[winfo exists $nb.tab1]} {
	$nb add $nb.tab1
    } else {
	set tab1 [ttk::frame $nb.tab1]
	$nb add $tab1 -text "This is the first tab" -padding 2
    }
}

proc opt1 {nb} {
    foreach tab [lrange [$nb tabs] 0 end] {
	$nb hide $tab
    }
    if {[winfo exists $nb.tab4]} {
	$nb add $nb.tab4
    } else {
	set tab4 [ttk::frame $nb.tab4]
	$nb add $tab4 -text "Another tab" -padding 2
    }
}

build_pref