Re: [Matplotlib-users] close gtk2 figure without main_quit() call

2011-08-02 Thread Benjamin Root
On Mon, Aug 1, 2011 at 2:44 PM, Alexey Uimanov  wrote:

> I am writing gtk2 application on python, I need to plot a chart in
> separate window and i just use this code
>
>def matplot_print(self, print_values):
>"""\brief print data by matplotlib and shw the figure
>\param print_values [(name - is a string, [(datetime, value)]
> - is a list of data to plot)] - list of charts to plot
>"""
>fig = plt.figure()
>ax = fig.add_subplot(111)
>names = map(lambda a: a[0], print_values)
>lines  = map(lambda chart: ax.plot_date(map(lambda chd:
> chd[0], chart[1]),
>map(lambda chy:
> chy[1], chart[1]), '-'), print_values)
>plt.figlegend(lines, names, 'upper left')
>
>majloc = AutoDateLocator()
>majform = AutoDateFormatter(majloc)
>ax.xaxis.set_major_locator(majloc)
>ax.xaxis.set_major_formatter(majform)
>ax.autoscale_view()
>ax.grid(True)
>fig.autofmt_xdate()
>fig.show()
>
> The figure is showing and everything works before closing the window
> of figure. It seems that figure call gtk.main_quit() when closing it's
> window. How to override this behaviour ?
>
>
I think what is happening is that matplotlib assumes that if it has to
create the figure window itself, then it assumes that it has to manage the
main loop itself as well.  Is it possible to have the main application
provide the window object for embedding the matplotlib figure within?

Ben Root
--
BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA
The must-attend event for mobile developers. Connect with experts. 
Get tools for creating Super Apps. See the latest technologies.
Sessions, hands-on labs, demos & much more. Register early & save!
http://p.sf.net/sfu/rim-blackberry-1___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users


[Matplotlib-users] close gtk2 figure without main_quit() call

2011-08-01 Thread Alexey Uimanov
I am writing gtk2 application on python, I need to plot a chart in
separate window and i just use this code

def matplot_print(self, print_values):
"""\brief print data by matplotlib and shw the figure
\param print_values [(name - is a string, [(datetime, value)]
- is a list of data to plot)] - list of charts to plot
"""
fig = plt.figure()
ax = fig.add_subplot(111)
names = map(lambda a: a[0], print_values)
lines  = map(lambda chart: ax.plot_date(map(lambda chd:
chd[0], chart[1]),
map(lambda chy:
chy[1], chart[1]), '-'), print_values)
plt.figlegend(lines, names, 'upper left')

majloc = AutoDateLocator()
majform = AutoDateFormatter(majloc)
ax.xaxis.set_major_locator(majloc)
ax.xaxis.set_major_formatter(majform)
ax.autoscale_view()
ax.grid(True)
fig.autofmt_xdate()
fig.show()

The figure is showing and everything works before closing the window
of figure. It seems that figure call gtk.main_quit() when closing it's
window. How to override this behaviour ?

--
BlackBerry® DevCon Americas, Oct. 18-20, San Francisco, CA
The must-attend event for mobile developers. Connect with experts. 
Get tools for creating Super Apps. See the latest technologies.
Sessions, hands-on labs, demos & much more. Register early & save!
http://p.sf.net/sfu/rim-blackberry-1
___
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users