Tk Source Code

Migrating scripts to Tk 9
Login

Work in progress... Currently focused on incompatibilities. Possibly hints on improving scripts making use of new facilities could be added at some point.

The migration tool may help identify some of these issues. Download

Removal of the -file option to wish

The option -file and its abreviations are no longer supported by the wish executable. This option is historic and was not documented in TK 8.6.

Size related options have become scalable

It was common to specify the values of various options in pixels. This does not work with higher display scaling levels. Now most option values are specified in points instead.

For more consistency, the following ttk style options are renamed:

See TIP 681

Two-finger touchpad scrolling on win32 and aqua no longer generates MouseWheel events

To handle the directional nature of touchpad scroll, two-finger gestures on the windowing systems win32 and aqua now generate TouchpadScroll rather than MouseWheel events. Consequently, new bindings are required, as described in TIP 648.

Index values unification

Options taking an index (like -underline) are now unified to take the TCL style (like end-5 in lindex $l end-5). The compatibility change is that the default value for not active (like no underline) got unified to the empty string. The former values (-1 for underline, none for no menu index) are still accepted but internally changed to the empty string.

In TCL 9, the last command returns the empty string, while Tk 8.6 returns -1.

% pack [label .l -text ABC -underline -1]
% puts "\"[.l cget -underline]\""
""

TCL 8.6 would return "-1" for the last command.

% tk_optionMenu .foo myVar Foo Bar Boo Spong Wibble
.foo.menu
% .foo.menu activate none
% puts "\"[.foo.menu index active]\""
""

TCL 8.6 would return "none" for the last command.

See TIP 577.