mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-07 12:44:28 +08:00
tkinter: font size must be integer (#11295)
This commit is contained in:
@@ -15,8 +15,11 @@ ITALIC: Literal["italic"]
|
||||
_FontDescription: TypeAlias = (
|
||||
str # "Helvetica 12"
|
||||
| Font # A font object constructed in Python
|
||||
| list[Any] # ("Helvetica", 12, BOLD)
|
||||
| tuple[Any, ...]
|
||||
| list[Any] # ["Helvetica", 12, BOLD]
|
||||
| tuple[str] # ("Liberation Sans",) needs wrapping in tuple/list to handle spaces
|
||||
| tuple[str, int] # ("Liberation Sans", 12)
|
||||
| tuple[str, int, str] # ("Liberation Sans", 12, "bold")
|
||||
| tuple[str, int, list[str] | tuple[str, ...]] # e.g. bold and italic
|
||||
| _tkinter.Tcl_Obj # A font object constructed in Tcl
|
||||
)
|
||||
|
||||
|
||||
@@ -20,3 +20,11 @@ def foo(x: int, y: str) -> None:
|
||||
|
||||
root.after(1000, foo, 10, "lol")
|
||||
root.after(1000, foo, 10, 10) # type: ignore
|
||||
|
||||
|
||||
# Font size must be integer
|
||||
label = tkinter.Label()
|
||||
label.config(font=("", 12))
|
||||
label.config(font=("", 12.34)) # type: ignore
|
||||
label.config(font=("", 12, "bold"))
|
||||
label.config(font=("", 12.34, "bold")) # type: ignore
|
||||
|
||||
Reference in New Issue
Block a user