Hi all,
I'm having trouble displaying an image using the imshow() command in an embedded
TkinterCanvasAgg. I used mostly the examples embedding_in_tk2.py and
embedding_in_tk.py
I use two code parts : in my __init__ for the gui def I have :
self.mplfImageDisplay = mpl.figure.Figure(figsize=(5,4), dpi=100)
#add tk.DrawingArea
self.cvImageDisplay =
FigureCanvasTkAgg(self.mplfImageDisplay,master=rightPaneImageDisplay)
#self.canvas.show()
self.cvImageDisplay.get_tk_widget().pack()
#add toolbar
toolbar = NavigationToolbar2TkAgg(self.cvImageDisplay,rightPaneImageDisplay)
toolbar.update()
self.cvImageDisplay._tkcanvas.pack()
then in one of my functions, if I use :
a = self.mplfImageDisplay.add_subplot(111)
a.contourf(x,y,self.scanformatdata,100) #cmap=mpl.cm.gray)
self.cvImageDisplay.show()
This works fine, but now, I would like to display an image :
a = mpl.image.FigureImage(na.asarray(self.scanformatdata))
self.cvImageDisplay.show()
This works but I can rescale the image not zoom in using the toolbar, so I tried
instead :
a = mpl.axes.Axes(self.mplfImageDisplay,[0.1,1,0.1,1])
a.imshow(na.asarray(self.scanformatdata),interpolation='nearest')
self.cvImageDisplay.show()
This does something but I don't know what since nothing is displayed...
Anyone has a clue ? Also, more generally speaking, I found quite extensive
documentation using the Pylab interface, but as soon as one moves away from
this (as when you need to if trying to embed in whatever backend, if i
understand well), then there doesn't exist much (?)... is there any source I
would have missed ?
All the best,
Aure