'''wm title''' ''window ?string?'' If ''string'' is specified, then it will be passed to the [window manager] for use as the title for ''window'' (the window manager should display this string in window's title bar). In this case the command returns an empty string. If ''string'' isn't specified then the command returns the current title for the window. The title for a window defaults to its name. ---- Subcommand of [Tk]'s [wm] to query or set the title of a toplevel window. ---- For editor-like apps, it is convenient to put the current file name into the title bar: wm title $w $filename or, combined with the app name (Windows look & feel): wm title $w "$filename - $appname" You can even retrieve the filename from there with [regexp], avoiding a [global] variable: regexp "(.+) - $appname" [wm title $w] -> filename ;# RS Windows 2000 tolerates Unicodes (e.g. Chinese characters) in the title bar, but (at least at 8.3.4) ''wm title'' converts the title to system encoding, so everything exotic mostly ends up as question marks. [[Is this logged at SourceForge as a bug?]] ---- Maybe [wm title] could for 9.0 be deprecated/aliased in favor of $window cget -title $window configure -title $title just to be a little bit more orthogonal? ([RS]) ----- '''Update of the wm file problem under Windows 98''' 2005/1/11 BM - file open / read problem What am I doing wrong here? The following code works in Linux, but under win98 the wm title is updated with "/" as the separator and the application then freezes requiring a 3 finger salute to kill it. $fidd is a full pathname of a jpg file, the 1st read dumps 6 bytes, the second reads the file type (JFIF of EXIF) which is then displayed in the label .type wm title . "File = $fidd" set fid [open $fidd r] set type [read $fid 6] set type [read $fid 4] close $fid .type conf -text $type Any ideas please. [Peter Newman] 11 January 2005: The "/" if the filename is correct; because Tcl always uses "/" as the file separator, even on Windows. To get backslashes use:- wm title . "File = [file nativename $fidd]" The rest of the code looks OK to me. I assume you created the widget?:- label .type Does it work if you comment out the open/read/close - and replace it with say:- set type "Hello World!" Presumably ''read'' is blocking for some reason. Have you been fiddling with ''fconfigure''? Or maybe it's the data in the file? Windows treats 1 ASCII character as an EOF character. And you can open files in ''binary'' or ''text'' mode. So if it's ''text mode'' - and you get the EOF character in the data - then presumably read will hang - because it waiting forever for the 4 or 6 bytes. That's consistent with it working on Linux but not Windows. Sorry, I can't recall the exact details of all this. It's documented somewhere, but I can't remember where. 13/01/2005 BM thanks for the reply. The code above checked out ok. The problem has been traced to the read command following: set tst [read $fid 2 } binary scan $tst S* jump .ed2 insert end "jump = $jump" #display the decimal value of jump In linux the code works fine, in windows the read returns an empty string if the characters read are outside the printable range. The file has been opened r and encoding set to binary. Can you help on this one please. [Peter Newman] 13 January 2005: That closing brace on the first line is a Wiki page only typo I assume? [B M] 13/1/04: Yes it should be ]. what I am doing is scanning a jpeg file for tags. The app crashes sometimes after finding the Exif tag FF E1. The 2 bytes being read are the length of the exif data which in some instances is not processed. 2 instances where it fails are when it reads in \x1A \x55, and \x1A \x5A while \x1D \x83 is processed correctly [Peter Newman] 13 January 2005: Hex 1A is the nasty EOF char that causes problems in Windows. From the ''fconfigure'' manpage it looks to me like you have to set:- -encoding binary -translation binary -eofchar {} ''BM'' 14/1/2005 Thanks Peter,that solved the problem ----- [Tk syntax help] - [Category Command]