Tk Source Code

Artifact [66c4c0b6]
Login

Artifact 66c4c0b6893c0fc8e045468440e618b887d357ad6f590d60090ae7c26ecf5664:

Attachment "placetest.tcl" to ticket [eb332846] added by fvogel 2024-09-29 20:48:34.
package require Tk

proc newWindows {} {
    destroy .top
    toplevel .top -width 500 -height 200

    set f1 [frame .top.f1 -background LightYellow]
    set f2 [frame .top.f2 -background LightYellow]
    place $f1 -x 15 -y 10 -width 120 -height 100
    place $f2 -x 150 -y 10 -width 120 -height 100

    set w1 [listbox $f1.w -width 80 -height 80]
    $w1 insert end "Listbox 1"
    place $w1 -x 10 -y 10
    bind $w1 <Destroy> {
	catch {lindex [place info %W] 1} win1
	puts "win1: $win1"
    }

    set w2 [listbox $f2.w -width 80 -height 80]
    $w2 insert end "Listbox 2"
    place $w2 -x 10 -y 10
    bind $w2 <Destroy> {
	catch {lindex [place info %W] 1} win2
	puts "win2: $win2"
    }
}

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