Version 6 of wm title

Updated 2003-09-15 18:39:28

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?]


Tk syntax help - Category Command