Importing tkinter in Glyphs Python

Hello, I’m running the application’s internal Python (version 3.10.11) on Glyphs 3.2 (3234).
However, I cannot import tkinter due to a library loading error, although it seems that the tkinter is already installed on /Users/username/Library/Application Support/Glyphs 3/Repositories/GlyphsPythonPlugin/Python.framework/Versions/3.10/lib/python3.10/tkinter/.

I’d like to know how to import tkinter correctly. I have pasted the error message below.

  File "", line 37
    import _tkinter # If this fails your Python may not be configured for Tk
ImportError: dlopen(/Users/sanga/Library/Application Support/Glyphs 3/Repositories/GlyphsPythonPlugin/Python.framework/Versions/3.10/lib/python3.10/lib-dynload/, 0x0002): Library not loaded: '/Library/Frameworks/Python.framework/Versions/3.10/lib/libtcl8.6.dylib'
  Referenced from: '/Users/sanga/Library/Application Support/Glyphs 3/Repositories/GlyphsPythonPlugin/Python.framework/Versions/3.10/lib/python3.10/lib-dynload/'
  Reason: tried: '/Library/Frameworks/Python.framework/Versions/3.10/lib/libtcl8.6.dylib' (no such file), '/usr/lib/libtcl8.6.dylib' (no such file)

Thank you.

I never tried using tkinter in Glyphs. Can you try to get it to work with python from

What exactly do you like to do with it?

I’m making a script with the tkinter GUI panel.
In order to simplify the installation process (for non-developers), I’d like to import tkinter initially installed in Glyphs so that the end users don’t have to install an additional package or external Python interpreter.
By the way, the script I implemented runs without any problem in external Python. (both conda and virtualenv environment)

Can you send me a sample script? I’ll give it a try when I find time.

The minimal working example would just be

import tkinter as tk

Since the error occurs during the execution of tkinter’s __init.py__, I think there’s an issue locating the tkinter-related library files rather than importing and installing the package.

Traditionally, type design community uses Vanilla instead of Tkinter, hence the poor support. If you look around for other scripts for Glyphs and Robofont, you can find plenty of them using Vanilla, and you can expect virtually all users (who use scripts) to have it installed.
(Just suggesting an existing solution, not forcing you or anything)

Came here to second what Toshi said. From experience I can tell you that you will have way less obstacles using Vanilla instead. Tkinter is a library for UIs that support not only Mac, but also Windows. Hence it is rather heavy (and ugly). When you make a plugin for Glyphs, you can be sure that your users will not have a Windows machine for it, so Vanilla is way more streamlined, and easy to install if the user doesn’t already have it.