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

  1. #!/usr/bin/env tclsh
  2.  
  3. package require Tk
  4.  
  5. proc entry_insert {entry_name value} {
  6. $entry_name configure -state normal
  7. $entry_name delete 0 end
  8. $entry_name insert end $value
  9. $entry_name configure -state readonly -readonlybackground white
  10. }
  11.  
  12. panedwindow .pw -orient horizontal
  13. labelframe .pw.x1 -text Bapy
  14. label .pw.x1.l1 -text "L1" -justify left
  15. entry .pw.x1.e1 -width 48 -justify right
  16. entry_insert .pw.x1.e1 "AAAAAAAAAA"
  17.  
  18. # -sticky e because it should be next to the [entry], not really needed
  19. grid .pw.x1.l1 -row 0 -column 0 -sticky e
  20. # -sticky ew means it should always touch both the east and west sides of its
  21. # grid cell, and be resized as necessary
  22. grid .pw.x1.e1 -row 0 -column 1 -sticky ew
  23. # setting a nonzero weight for column 1 allows the widths of cells in column 1
  24. # to actually change as the container is resized
  25. grid columnconfigure .pw.x1 1 -weight 1
  26.  
  27. # These don't need to be [grid]ed, the panedwindow takes care of them
  28. #grid .pw.x1 -row 0 -column 0
  29.  
  30. labelframe .pw.x2 -text Mojo
  31. label .pw.x2.l1 -text "L2" -justify left
  32. entry .pw.x2.e1 -width 48 -justify right
  33. entry_insert .pw.x2.e1 "AAAAAAAAAA"
  34.  
  35. grid .pw.x2.l1 -row 0 -column 0 -sticky e
  36. grid .pw.x2.e1 -row 0 -column 1 -sticky ew
  37. grid columnconfigure .pw.x2 1 -weight 1
  38.  
  39. #grid .pw.x2 -row 0 -column 1
  40.  
  41. .pw add .pw.x1
  42. .pw add .pw.x2
  43.  
  44. grid .pw -sticky nsew
  45. grid rowconfigure . 0 -weight 1
  46. grid columnconfigure . 0 -weight 1
  47.