From: Yo m. H. <miq...@gm...> - 2007-09-19 08:55:25
|
Hi all! I'm actually working with Matplotlib/Pylab Interface for making 2D plot. I need to specify screen location where the frame will appear and I don't know how. Supose a simple example like: from pylab import * t = arange(0.0,10,0.01) s = 20*sin(2*pi*t) c = 20*cos(2*pi*t) figure(1) plot(s) figure(2) plot(c) show() If I do it in this way, one frame is hidded behind the other one. How can I modify frames attributes in order to change their position on the screen? Thanks in advance, Miquel |
From: John H. <jd...@gm...> - 2007-09-20 17:08:00
|
On 9/19/07, Yo mismo Hotmail <miq...@gm...> wrote: > Hi all! > > I'm actually working with Matplotlib/Pylab Interface for making 2D plot. I > need to specify screen location where the frame will appear and I don't know > how. Supose a simple example like: > > from pylab import * > > t = arange(0.0,10,0.01) > s = 20*sin(2*pi*t) > c = 20*cos(2*pi*t) > > figure(1) > plot(s) > figure(2) > plot(c) > show() > > If I do it in this way, one frame is hidded behind the other one. How can I > modify frames attributes in order to change their position on the screen? pylab doesn't explicitly support this -- I have encouraged backend maintainers to attach the window instance to the figure manager instance, but I am not sure of all backends support this (GTK* and Tk do...). The window instance will be a GUI specific widget. Eg in the GTK* backends, a gtk.Window fig = figure() fig.canvas.manager.window.move(100,400) and other methods at http://www.pygtk.org/pygtk2reference/class-gtkwindow.html#method-gtkwindow--set-position If you need a lot of control, you are advised to embed mpl into a GUI app, eg see examples/embedding*.py in the mpl examples dir http://matplotlib.sourceforge.net/examples/http://matplotlib.sourceforge.net/examples/ JDH |
From: Yo m. H. <miq...@gm...> - 2007-09-21 16:30:49
|
Dear John, First of all, thanks for your response. When I try this fig = figure() fig.canvas.manager.window.move(100,400) python tells me that window has no attribute move. It's strange because I can choose many differents attributes like >>> fig.canvas.manager.window <Tkinter.Tk instance at 0x019100F8> >>> fig.canvas.manager.window.attributes <bound method Tk.wm_attributes of <Tkinter.Tk instance at 0x019100F8>> >>> fig.canvas.manager.window.frame <bound method Tk.wm_frame of <Tkinter.Tk instance at 0x019100F8>> Then I've got a window class from Tk, but not the attriburte move. I need to install Tkinter apart? Pylab suports differents GUIs. When you install matplotlib/pylab package wich backends are installed? All? I know embedding it's a good option, but for the moment it's too much work for me. I've got not enought time. My programe has got differents modules that call pylab plots, and a simple GUI which call this modules. I hope I can move canvas frames. In the future I'll embedding matplotlib with some package like wxmpl, but in the future. Thanks again, Miquel On 9/20/07, John Hunter <jd...@gm...> wrote: > > On 9/19/07, Yo mismo Hotmail <miq...@gm...> wrote: > > Hi all! > > > > I'm actually working with Matplotlib/Pylab Interface for making 2D plot. > I > > need to specify screen location where the frame will appear and I don't > know > > how. Supose a simple example like: > > > > from pylab import * > > > > t = arange(0.0,10,0.01) > > s = 20*sin(2*pi*t) > > c = 20*cos(2*pi*t) > > > > figure(1) > > plot(s) > > figure(2) > > plot(c) > > show() > > > > If I do it in this way, one frame is hidded behind the other one. How > can I > > modify frames attributes in order to change their position on the > screen? > > pylab doesn't explicitly support this -- I have encouraged backend > maintainers to attach the window instance to the figure manager > instance, but I am not sure of all backends support this (GTK* and Tk > do...). The window instance will be a GUI specific widget. Eg in the > GTK* backends, a gtk.Window > > fig = figure() > fig.canvas.manager.window.move(100,400) > > and other methods at > > > http://www.pygtk.org/pygtk2reference/class-gtkwindow.html#method-gtkwindow--set-position > > If you need a lot of control, you are advised to embed mpl into a GUI > app, eg see examples/embedding*.py in the mpl examples dir > > > http://matplotlib.sourceforge.net/examples/http://matplotlib.sourceforge.net/examples/ > > > JDH > |
From: John H. <jd...@gm...> - 2007-09-21 16:45:36
|
On 9/21/07, Yo mismo Hotmail <miq...@gm...> wrote: > Dear John, > > First of all, thanks for your response. When I try this > > fig = figure() > fig.canvas.manager.window.move(100,400) > > python tells me that window has no attribute move. It's strange because I > can choose many differents attributes like Well, the example I posted was for a *gtk* window, not a tk window. You will need to look at the API for the tk window to make the correct call. We do not provide an abstract API across the GUI windows we utilize internally. We give you access to the widget, and if you want to make GUI specific calls on it, good luck, but this is not encouraged or supported. JDH JDH |
From: Christopher B. <Chr...@no...> - 2007-09-21 17:04:33
|
John Hunter wrote: >> fig = figure() >> fig.canvas.manager.window.move(100,400) > Well, the example I posted was for a *gtk* window, not a tk window. And, for what it's worth, wx spells it "Move()", with a capital "M". -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception Chr...@no... |