From 2ccc53bb6716463680fcf1d204642c46299b7f88 Mon Sep 17 00:00:00 2001 From: Stephen Morton Date: Thu, 28 Nov 2024 17:04:31 -0800 Subject: [PATCH] Add a couple missing tkinter things (#13149) --- stdlib/@tests/stubtest_allowlists/common.txt | 1 - stdlib/tkinter/__init__.pyi | 3 ++- stdlib/tkinter/font.pyi | 4 +++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/stdlib/@tests/stubtest_allowlists/common.txt b/stdlib/@tests/stubtest_allowlists/common.txt index d7881195a..8372082a7 100644 --- a/stdlib/@tests/stubtest_allowlists/common.txt +++ b/stdlib/@tests/stubtest_allowlists/common.txt @@ -95,7 +95,6 @@ multiprocessing.pool.Pool.Process multiprocessing.pool.ThreadPool.Process multiprocessing.synchronize.Semaphore.get_value tkinter.Misc.config -tkinter.font.Font.counter # ========== diff --git a/stdlib/tkinter/__init__.pyi b/stdlib/tkinter/__init__.pyi index 42abbd432..d6a234d67 100644 --- a/stdlib/tkinter/__init__.pyi +++ b/stdlib/tkinter/__init__.pyi @@ -627,7 +627,8 @@ class Misc: def __getitem__(self, key: str) -> Any: ... def cget(self, key: str) -> Any: ... def configure(self, cnf: Any = None) -> Any: ... - # TODO: config is an alias of configure, but adding that here creates lots of mypy errors + # TODO: config is an alias of configure, but adding that here creates + # conflict with the type of config in the subclasses. See #13149 class CallWrapper: func: Incomplete diff --git a/stdlib/tkinter/font.pyi b/stdlib/tkinter/font.pyi index 317f3068b..097c2e4b4 100644 --- a/stdlib/tkinter/font.pyi +++ b/stdlib/tkinter/font.pyi @@ -1,7 +1,8 @@ import _tkinter +import itertools import sys import tkinter -from typing import Any, Final, Literal, TypedDict, overload +from typing import Any, ClassVar, Final, Literal, TypedDict, overload from typing_extensions import TypeAlias if sys.version_info >= (3, 9): @@ -40,6 +41,7 @@ class _MetricsDict(TypedDict): class Font: name: str delete_font: bool + counter: ClassVar[itertools.count[int]] # undocumented def __init__( self, # In tkinter, 'root' refers to tkinter.Tk by convention, but the code