Posted to tcl by oldlaptop at Sun Aug 29 04:14:12 GMT 2021view pretty

#!/usr/bin/env tclsh

package require Tk

proc entry_insert {entry_name value} {
    $entry_name configure -state normal
    $entry_name delete 0 end
    $entry_name insert end $value
    $entry_name configure -state readonly -readonlybackground white

panedwindow .pw -orient horizontal
labelframe .pw.x1 -text Bapy
label .pw.x1.l1 -text "L1" -justify left
entry .pw.x1.e1 -width 48 -justify right
entry_insert .pw.x1.e1 "AAAAAAAAAA"

# -sticky e because it should be next to the [entry], not really needed
grid .pw.x1.l1 -row 0 -column 0 -sticky e
# -sticky ew means it should always touch both the east and west sides of its
# grid cell, and be resized as necessary
grid .pw.x1.e1 -row 0 -column 1 -sticky ew
# setting a nonzero weight for column 1 allows the widths of cells in column 1
# to actually change as the container is resized
grid columnconfigure .pw.x1 1 -weight 1

# These don't need to be [grid]ed, the panedwindow takes care of them
#grid .pw.x1 -row 0 -column 0

labelframe .pw.x2 -text Mojo
label .pw.x2.l1 -text "L2" -justify left
entry .pw.x2.e1 -width 48 -justify right
entry_insert .pw.x2.e1 "AAAAAAAAAA"

grid .pw.x2.l1 -row 0 -column 0 -sticky e
grid .pw.x2.e1 -row 0 -column 1 -sticky ew
grid columnconfigure .pw.x2 1 -weight 1

#grid .pw.x2 -row 0 -column 1

.pw add .pw.x1
.pw add .pw.x2

grid .pw -sticky nsew
grid rowconfigure . 0 -weight 1
grid columnconfigure . 0 -weight 1