From 73cb6bd3c963c88bc5ab7b5fb3057e296fc7fbff Mon Sep 17 00:00:00 2001 From: Matthias Klose Date: Tue, 16 Nov 2021 10:24:31 +0000 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 9049ca3..43bdbc8 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