Tk Source Code

Artifact Content
Bounty program for improvements to Tcl and certain Tcl packages.

Artifact ec22a376fb471ff0660c378c0a6e229ca95241276854ec3fb7ae4b695d1807a9:

Attachment "t2.tcl" to ticket [4966cad4] added by ralfixx 2017-10-02 12:38:23. (unpublished)
wm geometry . 500x100

set topfr .topfr
ttk::notebook $topfr
pack $topfr -expand true -fill both

# uncommenting the next line avoids the problem
# update idle

# create two frames with labels which are packed later when the page
# is selected
foreach fr {frame-1 frame-2} {

    set frames($fr) $topfr.$fr
    frame $frames($fr)
    bind $frames($fr) <Map> [list update idle]

    ### frame content
    set pfr [frame $frames($fr).pfr]
    pack $pfr

    # label is packed by mapping $pfr
    set subfr [label $pfr.l -text "LABEL ($fr)"]
    bind $pfr <Map> "puts MAP-%W ; [list pack $subfr]"

    ### add new page
    $topfr add $frames($fr) -text $fr
# select last page
$topfr select $frames($fr)