wm title

Subcommand of Tk's wm to query or set the title of a toplevel window.

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.

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"

While modern operating systems have APIs to display non-ASCII characters in window titles, Tk 8.3.4 is reported not to do this properly on at least Windows 2000, and no version of Tk does on Unix/X11 systems.

[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)