[Matplotlib-users] How do I use a grid geometry manager in a matplotlib tk backend

2010-03-11 Thread Kim Hansen
Hi matplotlib list,

I am a resonably experienced python and matplotlib user, when it comes to
make cmd line programs for batch processing, but I have never tried to make
python GUI before.

I am working on a prototype product, where I want the typical matplotlib
plotting window, but extended with controls, such that I can control certain
parameters determining what is being plotted.

I have looked at the embedding_in_tk.py example

http://matplotlib.sourceforge.net/examples/user_interfaces/embedding_in_tk.html

which uses the pack manager. That example works like a charm for me, and it
seems like i should be able to extend it for my needs

I have also managed to add controls to that using the Tkinter module and
pack(), i.e., the tedious to maintain pack manager

However, I would really like to use a grid geometry manager instead as I
find it much easier to manage. I have therefore tried to modify the example
to use grid instead by moifying the two pack lines in the example

...

#canvas.get_tk_widget().pack(side=Tk.TOP, fill=Tk.BOTH, expand=1)

canvas.get_tk_widget().grid(row=0)

...

#canvas._tkcanvas.pack(side=Tk.TOP, fill=Tk.BOTH, expand=1)

canvas._tkcanvas.grid(row=1)

...
However, when I try to run that code, I just get an empty form

I have tried other options in the grid method, with no success. I am sure i
must be missing something obvious? Admittedly, these backend things are
close to voodoo for me, so i am just trying to get a prrof of concepts, but
i would not claim that i really undertsnad what is going on.

I have tried to look for useful documentation for doing these kinds of
things, but I have had only limited success. Directions/links to relevant
material would be appreciated as well.

Thanks,

Kim
--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] How do I use a grid geometry manager in a matplotlib tk backend

2010-03-11 Thread Alan G Isaac
On 3/11/2010 8:35 AM, Kim Hansen wrote:
  I would really like to use a grid geometry manager instead

http://effbot.org/tkinterbook/grid.htm

hth,
Alan Isaac


--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


Re: [Matplotlib-users] How do I use a grid geometry manager in a matplotlib tk backend

2010-03-11 Thread Friedrich Romstedt
2010/3/11 Kim Hansen slaun...@gmail.com:
 canvas.get_tk_widget().grid(row=0)
 canvas._tkcanvas.grid(row=1)

I cannot reproduce your problem.  Can you maybe provide a
self-contained script to reproduce the behaviour?  Here is mine:

 import Tkinter
 import matplotlib
 tk = Tkinter.Tk()
 import matplotlib.figure
 fig = matplotlib.figure.Figure()
 fig.set_size_inches((3, 3))
 import matplotlib.backends.backend_tkagg
 canvas = matplotlib.backends.backend_tkagg.FigureCanvasTkAgg(fig, master = 
 tk)
 canvas.show()
 canvas.get_tk_widget().grid(row = 0, column = 0)  # or .grid(row = 0)

 tk.columnconfigure(0, weight = 1)
 tk.rowconfigure(0, weight = 1)
 canvas.get_tk_widget().grid_forget()
 canvas.get_tk_widget().grid(row = 0, column = 0, sticky = Tkinter.NSEW)

Btw, do you know some nice way to change the xy data of a plot?  At
the moment, I'm always clearing the figure and drawing again.

I also don't like the black frame around the figure, with my
self-coded backend using similar code as backend_tkagg.py, I don't
observe such a black frame.

Friedrich

--
Download Intel#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users