Tk Source Code

Artifact [336e3414]
Login

Artifact 336e34149707a65fefd1023f63a9ac0c3252854f16e0da9838fa1b6d3a2ae3eb:

Attachment "gridtest.tcl" to ticket [eb332846] added by nemethi 2024-09-27 19:44:31.
catch {console show}

proc newWindows {} {
    destroy .top
    toplevel .top

    set f1 [frame .top.f1 -background LightYellow]
    set f2 [frame .top.f2 -background LightYellow]
    grid $f1 $f2 -padx 15p -pady 15p

    set w1 [listbox $f1.w]
    $w1 insert end "Listbox 1"
    grid $w1 -padx 15p -pady 15p
    bind $w1 <Destroy> { puts "win1: [lindex [grid info %W] 1]" }

    set w2 [listbox $f2.w]
    $w2 insert end "Listbox 2"
    grid $w2 -padx 15p -pady 15p
    bind $w2 <Destroy> { puts "win2: [lindex [grid info %W] 1]" }
}

ttk::button .b -text "New Windows" -command newWindows
pack .b -padx 9p -pady 9p