TIP 612: Setting WM_CLASS for main/root window

Login
Author:         Benjamin Schnitzler <[email protected]>
State:          Draft
Type:           Project
Vote:           Pending
Created:        9-Dec-2021
Post-History:
Tcl-Version:    9.1
Keywords:       Tk

Abstract

This TIP proposes a command to allowing setting of a toplevel's class (especially the main window) after the creation of the window.

Rationale

Currently there seems to be no way to set the application class of the WM_CLASS property after the creation of the window. (It is possible to set the application name using tk appname <appname>.) It should be possible to update the application class, e.g. with a command like tk classname <classname>.

Proposal

This TIP proposes making the -class property of toplevels (and frames, because of shared code) be settable (with the configure method) after the widget is created. Note that doing this will not change the value of any options that have already been looked up (though it will affect future calls to option get), nor will it change the bindtags of the widget.

Note that setting the class of toplevels is currently possible at widget creation time. For the main application window, this means passing the -class option in the arguments processed by wish or during package require Tk.

Copyright

This document has been placed in the public domain.