Skip to content

Commit

Permalink
Fix for venv.
Browse files Browse the repository at this point in the history
Use sys.base_prefix if available inlieu of sys.prefix to find the libtk.dylib on macOS in venv's.
  • Loading branch information
mrJean1 authored May 4, 2020
1 parent b1a44ed commit 14033c6
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions examples/tkvlc.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"""

# Tested with Python 3.7.4, tkinter/Tk 8.6.9 on macOS 10.13.6 only.
__version__ = '19.07.29' # mrJean1 at Gmail dot com
__version__ = '20.05.04' # mrJean1 at Gmail

# import external libraries
import vlc
Expand All @@ -49,7 +49,7 @@

_isMacOS = sys.platform.startswith('darwin')
_isWindows = sys.platform.startswith('win')
_isLinux = sys.platform.startswith('linux')
_isLinux = sys.platform.startswith('linux')

if _isMacOS:
from ctypes import c_void_p, cdll
Expand All @@ -59,7 +59,8 @@
# to match the version number of tkinter, _tkinter, etc.
try:
libtk = 'libtk%s.dylib' % (Tk.TkVersion,)
libtk = joined(sys.prefix, 'lib', libtk)
prefix = getattr(sys, 'base_prefix', sys.prefix)
libtk = joined(prefix, 'lib', libtk)
dylib = cdll.LoadLibrary(libtk)
# getNSView = dylib.TkMacOSXDrawableView is the
# proper function to call, but that is non-public
Expand Down

0 comments on commit 14033c6

Please sign in to comment.