Bug report
Bug description:
import tkinter as tk import tkinter.font as tkfont root = tk.Tk() font_tuple = ("Calibri", -14) font = tkfont.Font(root, font_tuple) lb1 = tk.Label(root, text="Hello", font=font_tuple) lb1.pack() lb2 = tk.Label(root, text="Hello", font=font) lb2.pack() root.update() print(lb1.winfo_width(), lb1.winfo_height()) print(lb2.winfo_width(), lb2.winfo_height()) root.mainloop()
The font size differs between tuples and Font objects.
The documentation states it can be specified in pixels, but is this a bug?
CPython versions tested on:
3.14
Operating systems tested on:
Windows
Linked PRs
- gh-143990: Preserve negative pixel sizes in tkinter.font.Font #143992
- gh-143990: Allow tkinter.font.Font to wrap a font description #152025
- gh-143990: Preserve the size when creating a Font from a named font #153267
- gh-143990: Do not assume the requested font size in test_font #153322
- [3.15] gh-143990: Preserve the size when creating a Font from a named font (GH-153267) #153323
- [3.14] gh-143990: Preserve the size when creating a Font from a named font (GH-153267) (GH-153323) #153341
- [3.13] gh-143990: Preserve the size when creating a Font from a named font (GH-153267) (GH-153323) #153342