From 39f0037735562462efeebb11f319bd8b71a32c46 Mon Sep 17 00:00:00 2001 From: Andrew Svetlov Date: Tue, 3 Apr 2012 09:48:07 +0300 Subject: Issue #802310: Generate always unique tkinter font names if not directly passed --- Lib/tkinter/font.py | 5 ++++- Misc/NEWS | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Lib/tkinter/font.py b/Lib/tkinter/font.py index 0103195..27e0cc8 100644 --- a/Lib/tkinter/font.py +++ b/Lib/tkinter/font.py @@ -8,6 +8,7 @@ __version__ = "0.9" +import itertools import tkinter @@ -46,6 +47,8 @@ class Font: """ + counter = itertools.count(1) + def _set(self, kw): options = [] for k, v in kw.items(): @@ -75,7 +78,7 @@ class Font: else: font = self._set(options) if not name: - name = "font" + str(id(self)) + name = "font" + str(next(self.counter)) self.name = name if exists: diff --git a/Misc/NEWS b/Misc/NEWS index 2a05802..5d8b975 100644 --- a/Misc/NEWS +++ b/Misc/NEWS @@ -19,6 +19,8 @@ Core and Builtins Library ------- +- Issue #802310: Generate always unique tkinter font names if not directly passed. + - Issue #14151: Raise a ValueError, not a NameError, when trying to create a multiprocessing Client or Listener with an AF_PIPE type address under non-Windows platforms. Patch by Popa Claudiu. -- cgit v0.12