summaryrefslogtreecommitdiffstats
path: root/Lib/tkinter
diff options
context:
space:
mode:
authorAndrew Svetlov <andrew.svetlov@gmail.com>2012-04-03 06:48:07 (GMT)
committerAndrew Svetlov <andrew.svetlov@gmail.com>2012-04-03 06:48:07 (GMT)
commit39f0037735562462efeebb11f319bd8b71a32c46 (patch)
tree5b77ead09cf02312a1a8b965a996a0f7df5f7f90 /Lib/tkinter
parent5af3e1afb07a5d5409a149fe6640778b8adb6050 (diff)
downloadcpython-39f0037735562462efeebb11f319bd8b71a32c46.zip
cpython-39f0037735562462efeebb11f319bd8b71a32c46.tar.gz
cpython-39f0037735562462efeebb11f319bd8b71a32c46.tar.bz2
Issue #802310: Generate always unique tkinter font names if not directly passed
Diffstat (limited to 'Lib/tkinter')
-rw-r--r--Lib/tkinter/font.py5
1 files changed, 4 insertions, 1 deletions
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: