From c5905012d593c1277d0b941357c3bf219aa75f5f Mon Sep 17 00:00:00 2001 From: Matthias Klose Date: Thu, 23 Jul 2020 10:11:14 +0100 Subject: [PATCH] tkinter-import # 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 | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Lib/tkinter/__init__.py b/Lib/tkinter/__init__.py index a3378d0..8242f4d 100644 --- a/Lib/tkinter/__init__.py +++ b/Lib/tkinter/__init__.py @@ -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 -- 2.30.2