Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo


#2596 ttk::entry xview sub-command forces use of update idletasks

obsolete: 8.5.5
Joe English
Colin McDonald

Before the ttk::entry xview sub-command is invoked, an
update idletasks command must be executed in order to
update the entry scrolling information, otherwise the
sub-command doesn't work correctly e.g. the following
script is supposed to set an entry field value and
then scroll it to the end ready for editing:

pack [ttk::entry .e -width 8]
.e insert end abcdefghijklmnopqrstuvwxyz
.e xview [.e index end]

The field is left unscrolled, unless update idletasks
is inserted before the xview sub-command.

The use of update and update idletasks is generally
discouraged on comp.lang.tcl, unless *absolutely
necessary*, for well known reasons. Recursively
re-entering the event loop can lead to application
logic problems, the widget may have been destroyed,
etc. I don't think that it is desirable for a core
widget to force use of update idletasks just to
function correctly. It is particularly a nuisance if
a whole form of entry fields is being set ready for

The following change to generic/ttk/ttkEntry.c will
avoid the problem:

static int EntryXViewCommand(
Tcl_Interp *interp, int objc, Tcl_Obj *const objv[], void *recordPtr)
Entry *entryPtr = recordPtr;

/* If caller has requested that the widget view is
* adjusted to a given index "pathName xview index",
* then ensure that the scroll info is up-to-date.

if (objc == 3) {

return TtkScrollviewCommand(interp, objc, objv,

Proc ttk::entry::See in library/ttk/entry.tcl can then
also be modified to remove an update idletasks.


  • Colin McDonald
    Colin McDonald

    • milestone: --> obsolete: 8.5.5