I was having trouble getting matplotlib to link to the correct Tcl and
Tk, and as a result uncovered what I would call a bug, or at least
Basically, I have a custom Tcl/Tk installation, and I setup python to
correctly find them, so I have the expectation that Matplotlib would
use the same Tk. It can be pretty easily figured out just by
importing Tkinter. Anyway, I looked through the matplotlib
setupext.py and discovered that there is a function that does this,
and correctly: query_tcltk
anyway, the logic in the setupext file is such that if the
sys.platform is 'darwin' then it will look for a Framework first
(maybe only), and since there is always an ancient system version of
Tcl and Tk, it will always pick those before anywhere else.
The system frameworks are not complete, and I know you all recommend
installing a binary with everything in it. Unfortunately, I did not
have this option for unimportant reasons.
Either way, I do believe that it is a bug that it does not choose the
Tk that is being used by Python or at least trying to before using
other available libraries and frameworks. This is easy enough for me
to fix just for myself and at work, but I believe that you all should
consider using Python's Tk for these reasons:
1). If python was installed from source, this is the one that the
user configured python to use, and therefore is the one they trust.
2). If the Tk/Tcl libraries were installed from source instead of
using the binaries you suggested installing, then it will just use the
wrong system Framework anyway. I bet people using macports and other
unix-like package managers on mac end up submitting a lot of bug
reports over this.
3). It is just more predictable and sustainable if modules set Python
as their standard base. Besides, it isn't much work as you already
wrote a function to find the correct tcl and tk.
4). I don't mind helping write the patch. I am only worried about
not knowing the intricacies of all the random supported platforms that
you all look out for. For example: I know jack about Windows linking.
Either way, I'll update it if you have someone look at it. I'll work
on it sometimes this week when I'm not too busy at work and send it
I am hoping that I convinced you all, and look forward to helping fix this.
Have a great rest-of-the-week!