tcl / tk:设置BWidget :: Label的位置

时间:2018-02-07 11:05:04

标签: tcl tk bwidget

我在BWidget大型机中显示标签,并希望它位于布局的顶部。我尝试了-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

0 个答案:

没有答案