mirror of
https://github.com/python/cpython.git
synced 2025-11-01 10:45:30 +00:00
Patch from /F:
this patch adds a fast _flatten function to the _tkinter module, and imports it from Tkinter.py (if available). this speeds up canvas operations like create_line and create_polygon. for example, a create_line with 5000 vertices runs about 50 times faster with this patch in place.
This commit is contained in:
parent
74042d6e5d
commit
e475e70128
2 changed files with 106 additions and 0 deletions
|
|
@ -39,6 +39,9 @@ def _flatten(tuple):
|
|||
res = res + (item,)
|
||||
return res
|
||||
|
||||
try: _flatten = _tkinter._flatten
|
||||
except AttributeError: pass
|
||||
|
||||
def _cnfmerge(cnfs):
|
||||
if type(cnfs) is DictionaryType:
|
||||
return cnfs
|
||||
|
|
@ -55,6 +58,9 @@ def _cnfmerge(cnfs):
|
|||
cnf[k] = v
|
||||
return cnf
|
||||
|
||||
try: _cnfmerge = _tkinter._cnfmerge
|
||||
except AttributeError: pass
|
||||
|
||||
class Event:
|
||||
pass
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue