mirror of
https://github.com/python/cpython.git
synced 2025-09-20 07:31:10 +00:00
Issue #802310: Generate always unique tkinter font names if not directly passed
This commit is contained in:
parent
5af3e1afb0
commit
39f0037735
2 changed files with 6 additions and 1 deletions
|
@ -8,6 +8,7 @@
|
||||||
|
|
||||||
__version__ = "0.9"
|
__version__ = "0.9"
|
||||||
|
|
||||||
|
import itertools
|
||||||
import tkinter
|
import tkinter
|
||||||
|
|
||||||
|
|
||||||
|
@ -46,6 +47,8 @@ class Font:
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
counter = itertools.count(1)
|
||||||
|
|
||||||
def _set(self, kw):
|
def _set(self, kw):
|
||||||
options = []
|
options = []
|
||||||
for k, v in kw.items():
|
for k, v in kw.items():
|
||||||
|
@ -75,7 +78,7 @@ class Font:
|
||||||
else:
|
else:
|
||||||
font = self._set(options)
|
font = self._set(options)
|
||||||
if not name:
|
if not name:
|
||||||
name = "font" + str(id(self))
|
name = "font" + str(next(self.counter))
|
||||||
self.name = name
|
self.name = name
|
||||||
|
|
||||||
if exists:
|
if exists:
|
||||||
|
|
|
@ -19,6 +19,8 @@ Core and Builtins
|
||||||
Library
|
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
|
- Issue #14151: Raise a ValueError, not a NameError, when trying to create
|
||||||
a multiprocessing Client or Listener with an AF_PIPE type address under
|
a multiprocessing Client or Listener with an AF_PIPE type address under
|
||||||
non-Windows platforms. Patch by Popa Claudiu.
|
non-Windows platforms. Patch by Popa Claudiu.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue