tkinter-import
authorMatthias Klose <doko@debian.org>
Thu, 30 Jul 2020 10:10:07 +0000 (11:10 +0100)
committerPeter Michael Green <plugwash@raspbian.org>
Thu, 30 Jul 2020 10:10:07 +0000 (11:10 +0100)
# DP: suggest installation of python-tk package on failing _tkinter import

# DP: suggest installation of python-tk package on failing _tkinter import

Gbp-Pq: Name tkinter-import.diff

Lib/tkinter/__init__.py

index a3378d012fb41ab2037b9932eddd1879607e94a2..8242f4deeb9a456889f7c599fc64769901021653 100644 (file)
@@ -34,7 +34,10 @@ import enum
 import sys
 import types
 
-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