File: tkinter-import.diff

package info (click to toggle)
python3.5 3.5.3-1%2Bdeb9u1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 88,448 kB
  • sloc: python: 491,123; ansic: 410,863; sh: 17,674; asm: 14,322; cpp: 4,123; makefile: 2,255; objc: 761; lisp: 502; exp: 499; pascal: 85; xml: 74; csh: 21
file content (18 lines) | stat: -rw-r--r-- 566 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# DP: suggest installation of python-tk package on failing _tkinter import

Index: b/Lib/tkinter/__init__.py
===================================================================
--- a/Lib/tkinter/__init__.py
+++ b/Lib/tkinter/__init__.py
@@ -32,7 +32,10 @@ tk.mainloop()
 
 import sys
 
-import _tkinter # If this fails your Python may not be configured for Tk
+try:
+    import _tkinter
+except ImportError as msg:
+    raise ImportError(str(msg) + ', please install the python3-tk package')
 TclError = _tkinter.TclError
 from tkinter.constants import *
 import re