Issue #802310: Generate always unique tkinter font names if not directly passed

This commit is contained in:
Andrew Svetlov 2012-04-03 09:48:07 +03:00
parent 5af3e1afb0
commit 39f0037735
2 changed files with 6 additions and 1 deletions

View file

@ -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: