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
}
이름이 변수에있는 창을 최대화하려면 다음을 win
사용하십시오.
wm state $win zoomed
Windows 및 Mac OS X 또는
wm attributes $win -zoomed 1
X11 시스템에서.
창 내부의 위젯을 확장 된 창의 크기에 맞게 확장하려면 지오메트리 관리자를 확장하도록 구성하십시오.
pack .mywidget -expand 1 -fill both ;# grow in both x and y
pack .mywidget -expand 1 -fill x ;# grow in x
pack .mywidget -expand 1 -fill y ;# grow in y
grid rowconfigure . .mywidget -weight 1 ;# this row will expand
grid columnconfigure . .mywidget -weight 1 ;# this column will expand
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다