Tk Source Code

Artifact [abbdd5d4]
Login

Artifact abbdd5d48e2ea08ad1df377f5a9e7fffc8cf7196c19fd8f0a1ad3953671b478b:

Attachment "gridtest2.tcl" to ticket [eb332846] added by nemethi 2024-09-28 10:24:26.
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> {
	catch {lindex [grid info %W] 1} win1
	puts "win1: $win1"
    }

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

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