default "q" shortcut?

Hi,

one thing I missed when I switched from Gnuplot to matplotlib was that I
can't press "q" to close a window but have to use the window manager; in
one environment I work in that means I have to use the mouse to close a
window.

I made a custom key handler that does the following:

        try:
            event.canvas.manager.destroy()
        except AttributeError:
            pass

which seems to work, at least with GtkAgg (I didn't venture to find out
why the AttributeError is raised, it works in spite of that).

Would it make sense to have that shortcut by default (and working for all
windowing backends)?

Georg

···

--
Thus spake the Lord: Thou shalt indent with four spaces. No more, no less.
Four shall be the number of spaces thou shalt indent, and the number of thy
indenting shall be four. Eight shalt thou not indent, nor either indent thou
two, excepting that thou then proceed to four. Tabs are right out.

I am +1 on that feature request. I don't have time to code it, though
:).

Gaël

···

On Wed, Oct 21, 2009 at 09:23:54AM +0200, Georg Brandl wrote:

Hi,

one thing I missed when I switched from Gnuplot to matplotlib was that I
can't press "q" to close a window but have to use the window manager; in
one environment I work in that means I have to use the mouse to close a
window.

Can you post your patch so that others can review?

Regards,

-JJ

···

On Wed, Oct 21, 2009 at 3:23 AM, Georg Brandl <g.brandl@...434...> wrote:

Hi,

one thing I missed when I switched from Gnuplot to matplotlib was that I
can't press "q" to close a window but have to use the window manager; in
one environment I work in that means I have to use the mouse to close a
window.

I made a custom key handler that does the following:

   try:
       event\.canvas\.manager\.destroy\(\)
   except AttributeError:
       pass

which seems to work, at least with GtkAgg (I didn't venture to find out
why the AttributeError is raised, it works in spite of that).

Would it make sense to have that shortcut by default (and working for all
windowing backends)?

Georg

--
Thus spake the Lord: Thou shalt indent with four spaces. No more, no less.
Four shall be the number of spaces thou shalt indent, and the number of thy
indenting shall be four. Eight shalt thou not indent, nor either indent thou
two, excepting that thou then proceed to four. Tabs are right out.

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

I don't have a patch. I just wrote a key handler that runs the snippet
I gave when "q" is pressed. I hope there's a better way to do it anyway :slight_smile:

Georg

Jae-Joon Lee schrieb:

···

Can you post your patch so that others can review?

Regards,

-JJ

On Wed, Oct 21, 2009 at 3:23 AM, Georg Brandl <g.brandl@...434...> wrote:

Hi,

one thing I missed when I switched from Gnuplot to matplotlib was that I
can't press "q" to close a window but have to use the window manager; in
one environment I work in that means I have to use the mouse to close a
window.

I made a custom key handler that does the following:

       try:
           event.canvas.manager.destroy()
       except AttributeError:
           pass

--
Thus spake the Lord: Thou shalt indent with four spaces. No more, no less.
Four shall be the number of spaces thou shalt indent, and the number of thy
indenting shall be four. Eight shalt thou not indent, nor either indent thou
two, excepting that thou then proceed to four. Tabs are right out.