Skip to content

Commit

Permalink
On failure to install tkinker, just print a warning
Browse files Browse the repository at this point in the history
  • Loading branch information
AshMartian committed Mar 8, 2024
1 parent 81e5830 commit 6c6ae04
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions __init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,19 @@ def install_tkinter():
try:
importlib.import_module('tkinter')
except ImportError:
import pip
pip.main(['install', 'tk'])
# If macOS, attempt to install via brew
import platform
if platform.system() == 'Darwin':
try:
import subprocess
subprocess.run(['brew', 'install', 'python-tk'])
except FileNotFoundError:
pass
try:
import pip
pip.main(['install', 'tk'])
# If macOS, attempt to install via brew
import platform
if platform.system() == 'Darwin':
try:
import subprocess
subprocess.run(['brew', 'install', 'python-tk'])
except FileNotFoundError:
pass
except:
print("Could not install tkinter")


install_tkinter()
Expand Down

0 comments on commit 6c6ae04

Please sign in to comment.