Pellegrini Eric wrote:
> Hi,
> 
> I have some problems to combine a matshow object with a canvas. Here is 
> a little piece of code that illustrates my problem. It displays a 
> matshow object when pressing a button.
> I would like to embed the matshow object into a canvas of a fixed 
> dimension. The code I wrote does the opposite i.e. it is the canvas that 
> adapts its size and not the matshow object. Would you have any hints ?
> 

I suspect this problem will be solved by a change I made to svn last 
night, providing a matshow Axes method that you would use in place of 
pylab.matshow.  Axes.matshow() simply makes and returns the image; it 
does not make a figure or set its dimensions, so you have full control 
over that.

Eric

> 
> ******************************************************************************
> from Tkinter import *
> from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg
> import pylab
> 
> def display():
>     mat = pylab.zeros((100,100))
>     pylab.ioff()
>     image = pylab.matshow(mat)
>     pylab.ion()
>     can = FigureCanvasTkAgg(image, master=frame)
>     can.show()
>     can.get_tk_widget().grid(row = 0,column = 0)
> 
> root = Tk()
> frame = Frame(root)
> frame.grid(row = 0,column = 0)
> canvas = Canvas(frame, width = 240, height = 240, relief = "sunken", bg 
> = "white")                
> canvas.grid()
> 
> button = Button(root,text="DisplayMatrix",command = display)
> button.grid(row = 1,column = 0)
> ****************************************************************************
> 
> Thank you very much
> 
> Eric
> 
> ------------------------------------------------------------------------
> Découvrez une nouvelle façon d'obtenir des réponses à toutes vos 
> questions ! Profitez des connaissances, des opinions et des expériences 
> des internautes sur Yahoo! Questions/Réponses 
> <http://fr.rd.yahoo.com/evt=42054/*http://fr.answers.yahoo.com>.
> 
> 
> ------------------------------------------------------------------------
> 
> -------------------------------------------------------------------------
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share your
> opinions on IT & business topics through brief surveys-and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Matplotlib-users mailing list
> Matplotlib-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/matplotlib-users


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to