summaryrefslogtreecommitdiffstats
path: root/Lib/tkinter/test/support.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/tkinter/test/support.py')
-rw-r--r--Lib/tkinter/test/support.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/Lib/tkinter/test/support.py b/Lib/tkinter/test/support.py
index 8fd0beb..fcd9ffc 100644
--- a/Lib/tkinter/test/support.py
+++ b/Lib/tkinter/test/support.py
@@ -86,6 +86,21 @@ def requires_tcl(*version):
return unittest.skipUnless(tcl_version >= version,
'requires Tcl version >= ' + '.'.join(map(str, version)))
+_tk_patchlevel = None
+def get_tk_patchlevel():
+ global _tk_patchlevel
+ if _tk_patchlevel is None:
+ tcl = tkinter.Tcl()
+ patchlevel = []
+ for x in tcl.call('info', 'patchlevel').split('.'):
+ try:
+ x = int(x, 10)
+ except ValueError:
+ x = -1
+ patchlevel.append(x)
+ _tk_patchlevel = tuple(patchlevel)
+ return _tk_patchlevel
+
units = {
'c': 72 / 2.54, # centimeters
'i': 72, # inches