[New-bugs-announce] [issue24408] tkinter.font.Font.measure() broken in 3.5

Martin Panter report at bugs.python.org
Mon Jun 8 15:22:17 CEST 2015

New submission from Martin Panter:

>>> import tkinter, tkinter.font
>>> tk = tkinter.Tk()
>>> tkinter.font.nametofont("TkHeadingFont").measure("string")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/proj/python/cpython/Lib/tkinter/font.py", line 154, in measure
    return self._root.tk.getint(self._call("font", "measure", self.name, *args))
AttributeError: 'Font' object has no attribute '_root'

This appears to be broken by revision cb80dd82d3da, Issue 23880, which included this change at the end of the measure() method:

-return int(self._call("font", "measure", self.name, *args))
+return self._root.tk.getint(self._call("font", "measure", self.name, *args))

The Font class does not have a “_root” attribute.

components: Tkinter
messages: 245003
nosy: serhiy.storchaka, vadmium
priority: normal
severity: normal
stage: needs patch
status: open
title: tkinter.font.Font.measure() broken in 3.5
type: behavior
versions: Python 3.5, Python 3.6

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list