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.
diff --git a/Lib/lib-tk/Tkinter.py b/Lib/lib-tk/Tkinter.py
index f8b4bd5..b4c9ccc 100644
--- a/Lib/lib-tk/Tkinter.py
+++ b/Lib/lib-tk/Tkinter.py
@@ -39,6 +39,9 @@
 			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 @@
 					cnf[k] = v
 		return cnf
 
+try: _cnfmerge = _tkinter._cnfmerge
+except AttributeError: pass
+
 class Event:
 	pass