【发布时间】:2014-11-18 23:24:50
【问题描述】:
我正在尝试使用 TK 包在 tcl 中创建一个窗口。
该窗口由 4 个文本小部件和一个菜单栏组成。
(像这样:http://artafact.be/sites/default/files/window.png)
但我希望窗口最大化到屏幕。
我尝试通过以下方式做到这一点:
set widthsmall [expr {int([winfo screenwidth .] * 0.25)}]
....
text .main \
-width $widthsmall -height $heightbig \
但这会产生一个比屏幕更宽的窗口!
这怎么可能?
proc buildUI {} {
global widthsmall
global widthbig
global heightsmall
global heightbig
frame .toolbar
scrollbar .vsb -command [list .main yview]
text .main \
-width $widthsmall -height $heightbig \
-yscrollcommand [list .vsb set] \
-highlightthickness 0
scrollbar .vsb1 -command [list .test yview]
text .test \
-width $widthbig -height $heightbig \
-yscrollcommand [list .vsb1 set] \
-highlightthickness 0
scrollbar .vsb2 -command [list .tsvf yview]
text .tsvf \
-width $widthsmall -height $heightsmall \
-yscrollcommand [list .vsb2 set] \
-highlightthickness 0
scrollbar .vsb3 -command [list .tobsw yview]
text .tobsw \
-width $widthbig -height $heightsmall \
-yscrollcommand [list .vsb3 set] \
-highlightthickness 0
button .b -text start -command start_sim
pack .b -in .toolbar -side left
grid .toolbar -sticky nsew -column 0 -row 0 -columnspan 2
grid .main .vsb -sticky nsew -column 0 -row 1
grid .test .vsb1 -sticky nsew -column 1 -row 1
grid .tsvf .vsb2 -sticky nsew -column 0 -row 2
grid .tobsw .vsb3 -sticky nsew -column 1 -row 2
}
【问题讨论】:
-
您的问题缺少代码,我们很难猜到。你如何打包或网格化它?