📄 oldpack.test
字号:
# This file is a Tcl script to test out the old syntax of Tk's# "pack" command (before release 3.3). It is organized in the# standard fashion for Tcl tests.## Copyright (c) 1991-1994 The Regents of the University of California.# Copyright (c) 1994 Sun Microsystems, Inc.## See the file "license.terms" for information on usage and redistribution# of this file, and for a DISCLAIMER OF ALL WARRANTIES.## SCCS: @(#) oldpack.test 1.10 97/06/24 13:32:16if {[string compare test [info procs test]] == 1} then \ {source defs}# First, test a single window packed in various ways in a parentcatch {destroy .pack}frame .packplace .pack -width 100 -height 100frame .pack.red -width 10 -height 20label .pack.red.l -text R -bd 2 -relief raisedplace .pack.red.l -relwidth 1.0 -relheight 1.0frame .pack.green -width 30 -height 40label .pack.green.l -text G -bd 2 -relief raisedplace .pack.green.l -relwidth 1.0 -relheight 1.0frame .pack.blue -width 40 -height 40label .pack.blue.l -text B -bd 2 -relief raisedplace .pack.blue.l -relwidth 1.0 -relheight 1.0frame .pack.violet -width 80 -height 20label .pack.violet.l -text P -bd 2 -relief raisedplace .pack.violet.l -relwidth 1.0 -relheight 1.0test pack-1.1 {basic positioning} { pack ap .pack .pack.red top update winfo geometry .pack.red} 10x20+45+0test pack-1.2 {basic positioning} { pack append .pack .pack.red bottom update winfo geometry .pack.red} 10x20+45+80test pack-1.3 {basic positioning} { pack append .pack .pack.red left update winfo geometry .pack.red} 10x20+0+40test pack-1.4 {basic positioning} { pack append .pack .pack.red right update winfo geometry .pack.red} 10x20+90+40# Try adding padding around the window and make sure that the# window gets a larger frame.test pack-2.1 {padding} { pack append .pack .pack.red {t padx 20} update winfo geometry .pack.red} 10x20+45+0test pack-2.2 {padding} { pack append .pack .pack.red {top pady 20} update winfo geometry .pack.red} 10x20+45+10test pack-2.3 {padding} { pack append .pack .pack.red {l padx 20} update winfo geometry .pack.red} 10x20+10+40test pack-2.4 {padding} { pack append .pack .pack.red {left pady 20} update winfo geometry .pack.red} 10x20+0+40# Position the window at different positions in its frame to# make sure they all work. Try two differenet frame locations,# to make sure that frame offsets are being added in correctly.test pack-3.1 {framing} { pack append .pack .pack.red {b padx 20 pady 30} update winfo geometry .pack.red} 10x20+45+65test pack-3.2 {framing} { pack append .pack .pack.red {bottom padx 20 pady 30 fr n} update winfo geometry .pack.red} 10x20+45+50test pack-3.3 {framing} { pack append .pack .pack.red {bottom padx 20 pady 30 frame ne} update winfo geometry .pack.red} 10x20+90+50test pack-3.4 {framing} { pack append .pack .pack.red {bottom padx 20 pady 30 frame e} update winfo geometry .pack.red} 10x20+90+65test pack-3.5 {framing} { pack append .pack .pack.red {bottom padx 20 pady 30 frame se} update winfo geometry .pack.red} 10x20+90+80test pack-3.6 {framing} { pack append .pack .pack.red {bottom padx 20 pady 30 frame s} update winfo geometry .pack.red} 10x20+45+80test pack-3.7 {framing} { pack append .pack .pack.red {bottom padx 20 pady 30 frame sw} update winfo geometry .pack.red} 10x20+0+80test pack-3.8 {framing} { pack append .pack .pack.red {bottom padx 20 pady 30 frame w} update winfo geometry .pack.red} 10x20+0+65test pack-3.9 {framing} { pack append .pack .pack.red {bottom padx 20 pady 30 frame nw} update winfo geometry .pack.red} 10x20+0+50test pack-3.10 {framing} { pack append .pack .pack.red {bottom padx 20 pady 30 frame c} update winfo geometry .pack.red} 10x20+45+65test pack-3.11 {framing} { pack append .pack .pack.red {r padx 20 pady 30} update winfo geometry .pack.red} 10x20+80+40test pack-3.12 {framing} { pack append .pack .pack.red {right padx 20 pady 30 frame n} update winfo geometry .pack.red} 10x20+80+0test pack-3.13 {framing} { pack append .pack .pack.red {right padx 20 pady 30 frame ne} update winfo geometry .pack.red} 10x20+90+0test pack-3.14 {framing} { pack append .pack .pack.red {right padx 20 pady 30 frame e} update winfo geometry .pack.red} 10x20+90+40test pack-3.15 {framing} { pack append .pack .pack.red {right padx 20 pady 30 frame se} update winfo geometry .pack.red} 10x20+90+80test pack-3.16 {framing} { pack append .pack .pack.red {right padx 20 pady 30 frame s} update winfo geometry .pack.red} 10x20+80+80test pack-3.17 {framing} { pack append .pack .pack.red {right padx 20 pady 30 frame sw} update winfo geometry .pack.red} 10x20+70+80test pack-3.18 {framing} { pack append .pack .pack.red {right padx 20 pady 30 frame w} update winfo geometry .pack.red} 10x20+70+40test pack-3.19 {framing} { pack append .pack .pack.red {right padx 20 pady 30 frame nw} update winfo geometry .pack.red} 10x20+70+0test pack-3.20 {framing} { pack append .pack .pack.red {right padx 20 pady 30 frame center} update winfo geometry .pack.red} 10x20+80+40# Try out various filling combinations in a couple of different# frame locations.test pack-4.1 {filling} { pack append .pack .pack.red {bottom padx 20 pady 30 fillx} update winfo geometry .pack.red} 100x20+0+65test pack-4.2 {filling} { pack append .pack .pack.red {bottom padx 20 pady 30 filly} update winfo geometry .pack.red} 10x50+45+50test pack-4.3 {filling} { pack append .pack .pack.red {bottom padx 20 pady 30 fill} update winfo geometry .pack.red} 100x50+0+50test pack-4.4 {filling} { pack append .pack .pack.red {right padx 20 pady 30 fillx} update winfo geometry .pack.red} 30x20+70+40test pack-4.5 {filling} { pack append .pack .pack.red {right padx 20 pady 30 filly} update winfo geometry .pack.red} 10x100+80+0test pack-4.6 {filling} { pack append .pack .pack.red {right padx 20 pady 30 fill} update winfo geometry .pack.red} 30x100+70+0# Multiple windows: make sure that space is properly subtracted# from the cavity as windows are positioned inwards from all# different sides. Also make sure that windows get unmapped if# there isn't enough space for them.pack append .pack .pack.red top .pack.green top .pack.blue top \ .pack.violet topupdatetest pack-5.1 {multiple windows} {winfo geometry .pack.red} 10x20+45+0test pack-5.2 {multiple windows} {winfo geometry .pack.green} 30x40+35+20test pack-5.3 {multiple windows} {winfo geometry .pack.blue} 40x40+30+60test pack-5.4 {multiple windows} {winfo ismapped .pack.violet} 0pack b .pack.blue .pack.violet topupdatetest pack-5.5 {multiple windows} {winfo ismapped .pack.violet} 1test pack-5.6 {multiple windows} {winfo geometry .pack.violet} 80x20+10+60test pack-5.7 {multiple windows} {winfo geometry .pack.blue} 40x20+30+80pack after .pack.blue .pack.red topupdatetest pack-5.8 {multiple windows} {winfo geometry .pack.green} 30x40+35+0test pack-5.9 {multiple windows} {winfo geometry .pack.violet} 80x20+10+40test pack-5.10 {multiple windows} {winfo geometry .pack.blue} 40x40+30+60test pack-5.11 {multiple windows} {winfo ismapped .pack.red} 0pack before .pack.green .pack.red right .pack.blue leftupdatetest pack-5.12 {multiple windows} {winfo ismapped .pack.red} 1test pack-5.13 {multiple windows} {winfo geometry .pack.red} 10x20+90+40test pack-5.14 {multiple windows} {winfo geometry .pack.blue} 40x40+0+30test pack-5.15 {multiple windows} {winfo geometry .pack.green} 30x40+50+0test pack-5.16 {multiple windows} {winfo geometry .pack.violet} 50x20+40+40pack append .pack .pack.violet left .pack.green bottom .pack.red bottom \ .pack.blue bottomupdatetest pack-5.17 {multiple windows} {winfo geometry .pack.violet} 80x20+0+40test pack-5.18 {multiple windows} {winfo geometry .pack.green} 20x40+80+60test pack-5.19 {multiple windows} {winfo geometry .pack.red} 10x20+85+40test pack-5.20 {multiple windows} {winfo geometry .pack.blue} 20x40+80+0pack after .pack.blue .pack.blue top .pack.red right .pack.green right \
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -