mirror of
https://github.com/python/cpython.git
synced 2025-07-24 03:35:53 +00:00
gh-97928: Change the behavior of tkinter.Text.count() (GH-98484)
It now always returns an integer if one or less counting options are specified. Previously it could return a single count as a 1-tuple, an integer (only if option "update" was specified) or None if no items found. The result is now the same if wantobjects is set to 0.
This commit is contained in:
parent
81eba76450
commit
b8c20f9049
5 changed files with 53 additions and 55 deletions
|
@ -25,10 +25,9 @@ def get_end_linenumber(text):
|
|||
|
||||
def get_displaylines(text, index):
|
||||
"""Display height, in lines, of a logical line in a Tk text widget."""
|
||||
res = text.count(f"{index} linestart",
|
||||
f"{index} lineend",
|
||||
"displaylines")
|
||||
return res[0] if res else 0
|
||||
return text.count(f"{index} linestart",
|
||||
f"{index} lineend",
|
||||
"displaylines")
|
||||
|
||||
def get_widget_padding(widget):
|
||||
"""Get the total padding of a Tk widget, including its border."""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue