I'm working on a plugin with a command line interface and a light-weight tk
interface through the plugins menu. This works fine on Linux, Windows, and
open-source Mac builds, but not on MacPyMol.app. Importing Tkinter causes
PyMol to quit with a prompt to install X11 (but not an ImportError, as far
as I can tell). If X11 is installed there are no errors, but there is not a
plugins menu, so I'd rather not bother loading and initializing the Tk
interface to the plugin.

How can I detect whether Tk is available?

I can think of two approaches, but haven't figured out the correct commands
for either. (1) Check the name that pymol was started with. "MacPyMol.app"
does not have Tk, while "PyMOLX11Hybrid.app" does.  I'm not sure how to get
the name (maybe could be guessed from sys.path?), and I know there are a
lot more variants than those two available. (2) Check for the existence of
the plugins menu. But this would have to be done without importing Tk and
triggering the X11 check.

Is there a simple way to do this I'm overlooking?

Thanks,
-Spencer
------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/NeoTech
_______________________________________________
PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net)
Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net

Reply via email to