home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.tcl
- Path: sparky!uunet!sun-barr!cs.utexas.edu!wupost!gumby!destroyer!sol.ctr.columbia.edu!The-Star.honeywell.com!umn.edu!sctc.com!scott
- From: scott@sctc.com (Scott Hammond)
- Subject: newbie tk question: extra window with 'wish -f'? && border?
- Message-ID: <1992Aug31.163347.25456@sctc.com>
- Organization: SCTC
- Date: Mon, 31 Aug 1992 16:33:47 GMT
- Lines: 62
-
- Trying to learn tk based on a demo fragment I've hacked.
- I have two questions:
-
- 1. When I run this, I get two windows, one which wish puts up
- automatically, and the one mkIcon puts up. How do I get rid
- of the first one?
-
- 2. Neither window has a border visible on a white background (B&W
- display). How do I make a visible border on the mkIcon's window?
-
- The code:
-
-
- set auto_path "$tk_library/demos $auto_path"
- #wm title . "Widget Demonstration"
-
-
- proc mkIcon {{w .icon}} {
- global tk_library
- catch {destroy $w}
- toplevel $w
- dpos $w
- wm title $w "Iconic Button test"
- wm iconname $w "Icons"
- message $w.msg -font -Adobe-times-medium-r-normal--*-180* -aspect 300 \
- -text "This is a test"
- frame $w.frame -borderwidth 10
- pack append $w.frame \
- [button $w.frame.b1 -bitmap @$tk_library/demos/bitmaps/flagdown \
- -command "iconCmd $w.frame.b1"] {left expand} \
- [frame $w.frame.right] {left expand}
- button $w.ok -text destroy -command "destroy $w"
-
- pack append $w $w.msg {top frame c} $w.frame {top expand fill} \
- $w.ok {bottom}
-
- return $w.frame.b1
- }
-
- proc iconCmd {w} {
- global tk_library
- set bitmap [lindex [$w config -bitmap] 4]
- if {$bitmap == "@$tk_library/demos/bitmaps/flagdown"} {
- $w config -bitmap @$tk_library/demos/bitmaps/flagup
- } else {
- $w config -bitmap @$tk_library/demos/bitmaps/flagdown
- }
- }
-
- # Position a dialog box at a reasonable place on the screen.
-
- proc dpos w {
- wm geometry $w +300+300
- }
-
- set xyz [ mkIcon ]
-
- puts stdout $xyz
-
-
- --
- Scott Hammond (scott@sctc.com)
-