this example:
http://matplotlib.org/examples/user_interfaces/embedding_in_tk.html
which appears to be coded to run in both python 2.7 and 3.x
crashes like this when I run it:
------------ begin log
$ ./embedding_in_tk.py
Traceback (most recent call last):
File "C:\Users\jcano\AppData\Local\Continuum\Anaconda3\lib\site-packages\matplotlib\backends\tkagg.py", line 13, in blit
tk.call("PyAggImagePhoto", photoimage, id(aggimage), colormode, id(bbox_array))
_tkinter.TclError: invalid command name "PyAggImagePhoto"
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "./foo.py", line 36, in <module>
canvas.show()
File "C:\Users\jcano\AppData\Local\Continuum\Anaconda3\lib\site-packages\matplotlib\backends\backend_tkagg.py", line 349, in draw
tkagg.blit(self._tkphoto, self.renderer._renderer, colormode=2)
File "C:\Users\jcano\AppData\Local\Continuum\Anaconda3\lib\site-packages\matplotlib\backends\tkagg.py", line 20, in blit
tk.call("PyAggImagePhoto", photoimage, id(aggimage), colormode, id(bbox_array))
_tkinter.TclError
------------ end log
My environment:
+ Windows 7
+ Anaconda 3 (Python 3.4.1) which I just downloaded yesterday
+ cygwin
I'm invoking my script from cygwin. This seems to work fine for scripts that don't crash. The beginning of my script looks like:
1 #!/cygdrive/c/Users/jcano/AppData/Local/Continuum/Anaconda3/python
2
3
4
5 import matplotlib
6 matplotlib.use('TkAgg')
7
8 from numpy import arange, sin, pi
9 from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg, NavigationToolbar2TkAgg
10 # implement the default mpl key bindings
I've used python a bit in the past but am completely new to TkInter and matplotlib.
I haven't tried Anaconda 2 (Python 2.7.8 based) yet. (Presumably) the future of python is python 3 so it would be nice to have this working in python 3.
I've successfully run several other matplotlib examples with the environment above.
Matplotlib looks really cool! I'm sure I'll be able to make it do what I want one way or another.
Regards,
--fj