[Python-checkins] cpython: Issue #802310: Generate always unique tkinter font names if not directly passed

andrew.svetlov python-checkins at python.org
Tue Apr 3 08:48:14 CEST 2012


http://hg.python.org/cpython/rev/a77e23135675
changeset: 76089:a77e23135675
user: Andrew Svetlov <andrew.svetlov at gmail.com>
date: Tue Apr 03 09:48:07 2012 +0300
summary:
 Issue #802310: Generate always unique tkinter font names if not directly passed
files:
 Lib/tkinter/font.py | 5 ++++-
 Misc/NEWS | 2 ++
 2 files changed, 6 insertions(+), 1 deletions(-)
diff --git a/Lib/tkinter/font.py b/Lib/tkinter/font.py
--- 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 @@
 
 """
 
+ counter = itertools.count(1)
+
 def _set(self, kw):
 options = []
 for k, v in kw.items():
@@ -75,7 +78,7 @@
 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
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -19,6 +19,8 @@
 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.
-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /