[RESOLVED] TKinter was broken on Canopy OS X 1.0.1, fixed in 1.0.3

(Also, please see this article: https://support.enthought.com/entries/21793229-Using-Tkinter-in-Canopy-s-IPython-panel)

TKinter was broken in Canopy (1.0.0 and 1.0.1) on Mac OS X. We apologize for the inconvenience. This has been fixed in Canopy 1.0.3, available by Help / Software Updates, or fresh install.

Here is a fix for 64-bit Canopy. You must have Xcode Command Line Tools installed.

Quit Canopy, run the following bash script, and restart Canopy:

set -e
cd $ROOT/appdata/canopy-
install_name_tool -change \
    /Library/Frameworks/Python.framework/Versions/111.222.33344/lib/libtcl8.5.dylib \
    /System/Library/Frameworks/Tcl.framework/Versions/8.5/Tcl _tkinter.so
install_name_tool -change \
    /Library/Frameworks/Python.framework/Versions/111.222.33344/lib/libtk8.5.dylib \
    /System/Library/Frameworks/Tk.framework/Versions/8.5/Tk  _tkinter.so
Have more questions? Submit a request


  • Avatar
    Jonathan March

    Comment from Frans van Dunné:

    Hi Jonathan,

    This works to the extent that I can now import tkinter modules. But I cannot actually see any interface. For example:

        from tkFileDialog import askopenfilename

        datos = askopenfilename()

    does not open a file dialog, nor does the proces exit on error. Canopy just hangs silently.

  • Avatar
    Prabhu Ramachandran

    It is not advisable to mix two UI toolkits in the same interactive session.  The primary problem is that the canopy shell defaults to using Qt as the UI backend.  If one switches the Pylab backend (in Preferences->Python->Pylab backend) to Inline this should work.  However, it might be better to use PySide for these sort of things with the Qt backend.

  • Avatar
    David Nicholls

    OK, thanks for the workaround.  If I run a program, within the Canopy editor, that uses blitting in matplotlib, it defaults to using the PyQT4 backend for matplotlib (set in the Python prefs for pylab), and the program works properly.  If, however, I run ipython (using either 'ipython' or 'ipython --pylab') from the OSX terminal window, I get a "blitting" error in the program, because the default matplotlib backend run from the terminal is 'MacOSX'.  Where do I set the pylab backend to PyQT4 so that Enthought IPython finds the setting when run from a terminal window?

  • Avatar
    David Nicholls

    Question answered: You need to change the backend information in matplotlibrc, specifically in:


    change line 32 to read:   backend : TkAgg

    Other backends are missing stuff (eg Qt4Agg leads to a missing 'sip' import).



  • Avatar
    Prabhu Ramachandran

    We just released 1.0.3.  Please update from Help->Canopy Application Updates... or download a fresh installer from the website.

  • Avatar
    Richard Jacob


    I installed the update to 1.0.3 but I'm still having a problem with Tkinter.  I'm using a Mac 10.6.8 os.  Below is some sample code that I lifted from http://docs.python.org/2/library/tkinter.html.  Canopy crashes on the line "root = Tk()".  Although my code is different, it crashes on a line with the same syntax.  Any suggestions would be greatly appreciated.


    from Tkinter import *

    class Application(Frame):
    def say_hi(self):
    print "hi there, everyone!"

    def createWidgets(self):
    self.QUIT = Button(self)
    self.QUIT["text"] = "QUIT"
    self.QUIT["fg"] = "red"
    self.QUIT["command"] = self.quit

    self.QUIT.pack({"side": "left"})

    self.hi_there = Button(self)
    self.hi_there["text"] = "Hello",
    self.hi_there["command"] = self.say_hi

    self.hi_there.pack({"side": "left"})

    def __init__(self, master=None):
    Frame.__init__(self, master)

    root = Tk()
    app = Application(master=root)

  • Avatar
    Jonathan March

    Rick, Transferring your issue to a support ticket for more effective conversation.

  • Avatar
    Prabhu Ramachandran

    The summary is you cannot run Tkinter along with pylab using the Qt backend.  Use the inline backend or turn off pylab from preferences and everything should work.

  • Avatar
    Richard Jacob

    That seems to do the trick.  Thank you for your help.

  • Avatar
    Stewart Fernandez


Powered by Zendesk