Skip to content

Commit 0502206

Browse files
RachidaTanassathorakivo
authored andcommitted
add automatic setup helper for GraalPy Tkinter support on macOS
- Added setup_tkinter() function to handle missing _tkinter module - Automatically installs pip dependencies and system requirements
1 parent b3c986c commit 0502206

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

graalpython/lib-python/3/tkinter/__init__.py

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
import enum
3535
import sys
3636
import types
37-
import traceback
3837

3938
def _setup_tkinter():
4039
import os
@@ -72,15 +71,10 @@ def _setup_tkinter():
7271

7372
try:
7473
import _tkinter
75-
except ModuleNotFoundError as e:
76-
tb = traceback.format_exc()
77-
missing_tklib = "_tkinter.tklib_cffi" in tb or "_tkinter" in tb
78-
79-
if missing_tklib:
80-
_setup_tkinter()
81-
import _tkinter
82-
else:
83-
TclError = _tkinter.TclError
74+
except Exception:
75+
_setup_tkinter()
76+
import _tkinter
77+
TclError = _tkinter.TclError
8478

8579
from tkinter.constants import *
8680
import re

0 commit comments

Comments
 (0)