我在 BWidget Mainframe 中显示一个标签,并希望它位于布局的顶部。我尝试了各种排列和组合-side
但-anchor
无济于事;看来我的心智模型不正确。
示例代码:
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
通过@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