Skip to content

Add tkinter Text methods sync() and pendingsync() #151675

@serhiy-storchaka

Description

@serhiy-storchaka

Feature or enhancement

The Tk text widget supports the pathName sync ?-command command? and pathName pendingsync subcommands, which control and report the synchronization of the displayed view with the underlying text when line heights have not yet been computed (for example, for lines that have never been displayed). These obsolete the -update option of pathName count and are accompanied by the <<WidgetViewSync>> virtual event. tkinter currently wraps none of them.

I propose adding two methods to tkinter.Text:

  • sync(command=None) — with no argument, immediately bring the line metrics up to date by forcing computation of any outdated line heights, returning once they are current. With command, schedule it to be called exactly once as soon as all line heights are up to date (or immediately if there are no pending calculations).
  • pendingsync() — return True if the line height calculations are not up to date, False otherwise.

Links to previous discussion

This is one of a few Tk text subcommands not yet wrapped by tkinter; edit canundo/edit canredo are tracked separately.

Linked PRs

Metadata

Metadata

Labels

stdlibStandard Library Python modules in the Lib/ directorytopic-tkintertype-featureA feature request or enhancement
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions