0

I'm showing a Label in a BWidget Mainframe and want it to be at the top of the layout. I've tried various permutations and combinations of -side and -anchor to no avail; it seems I have an incorrect mental model.

Example code:

package require BWidget
# Menu description
set descmenu {
    "&File" all file 0 {
        {command "E&xit" {} "Exit" {} -command exit}
    }
}

bind all <Escape> { exit }

set mainframe [MainFrame .mainframe -height 50 -textvariable statusText -menu $descmenu ]
$mainframe showstatusbar status
set statusText "<Escape> to { exit }"
wm deiconify .

#Label $mainframe.lab -anchor n -relief sunken -width 50 -helptext { move me to the top }
#pack $mainframe.lab -anchor n -side top
Label $mainframe.lab -relief sunken -width 50 -helptext { move me to the top }
pack $mainframe.lab
pack $mainframe

Working version via @sergei-golovan:

package require BWidget
# Menu description
set descmenu {
    "&File" all file 0 {
        {command "E&xit" {} "Exit" {} -command exit}
    }
}

bind all <Escape> { exit }

set mainframe [MainFrame .mainframe -height 50 -textvariable statusText -menu $descmenu ]
$mainframe showstatusbar status
set statusText "<Escape> to { exit }"
wm deiconify .

Label $mainframe.lab -relief sunken -width 50 -helptext { moved to the top }
pack $mainframe.lab -in [$mainframe getframe]
pack $mainframe
njamescouk
  • 127
  • 11

0 Answers0