From: Tim L. <ti...@cs...> - 2005-04-14 01:06:11
|
On Wed, 13 Apr 2005, Werner F. Bruhin <wer...@fr...> wrote... > Hi Tim and John, > > I didn't catch on to this earlier but shouldn't the backend_wx.py use > something along these lines: > > keyvald = {wx.WXK_CONTROL : 'control', > wx.WXK_SHIFT : 'shift', > wx.WXK_ALT : 'alt', > wx.WXK_LEFT : 'left', > wx.WXK_UP : 'up', > wx.WXK_RIGHT : 'right', > wx.WXK_DOWN : 'down', > } > > For more WXK codes see the wx demo Process and Events/KeyEvents. I suppose that would be the sane thing to do, yes. Presumably we can also find similar codes for GTK. I'll have a look for them today. Tim > > See you > Werner > > > Tim Leslie wrote: > >OK, here are the diffs for each backend: > > > >~/src/matplotlib-0.80/lib/matplotlib/backends/backend_gtk.py > >109,112d108 > >< 65361 : 'left', > >< 65362 : 'up', > >< 65363 : 'right', > >< 65364 : 'down', > > > >~/src/matplotlib-0.80/lib/matplotlib/backends/backend_wx.py > >675,678d674 > >< 316 : 'left', > >< 317 : 'up', > >< 318 : 'right', > >< 319 : 'down', > > > >~/src/matplotlib-0.80/lib/matplotlib/backends/backend_tkagg.py > >99,102d98 > >< 65361 : 'left', > >< 65362 : 'up', > >< 65363 : 'right', > >< 65364 : 'down', > > > >~/src/matplotlib-0.80/lib/matplotlib/backends/backend_qt.py > >74,77d73 > >< qt.Qt.Key_Left : 'left', > >< qt.Qt.Key_Up : 'up', > >< qt.Qt.Key_Right : 'right', > >< qt.Qt.Key_Down : 'down', > > > >As you can see, it's reasonably straightforward to add these extra keys, > >so if anyone feels creative and wants other keys added, this should give > >an idea of what needs changing. > > > >As for my problem with gtk and the down key, I've rebuilt pygtk (2.6.1), > >installed matplotlib 0.80, and the problem is still there. I whipped up a > >trivial pygtk program which was a window which connected to key press > >events and it worked just fine, so it seems that there's something that > >matplotlib is doing which triggers the bug (that's not to say the bug is > >in mpl of course). I'm guessing there is something in my system setup > >which is flakey and causing it to happen, but it's 3am and I'm tired so > >I'll just live with it for now :) > > > >Cheers, > > > >Tim Leslie > > > >On Thu, 14 Apr 2005, Tim Leslie <ti...@cs...> wrote... > > > > > >>Just to follow up on this, I made the required changes to the other > >>backends and they worked fine. GTK and GTKAgg had the same broken > >>behaviour while TkAgg, WX and WXAgg worked fine (don't have qt installed). > >> > >>I'll bring all my libraries up to date (thanks for 0.80 tonight) and dive > >>into the pygtk stuff a bit deeper to see if I can find out what's > >>breaking. > >> > >>Having looked through a bit more mpl code I'd just like to say that I'm > >>very impressed with how simple it is to read. After working out what to > >>change in GTK, it followed an identical pattern in the other backends > >>which was very nice to see. > >> > >>Cheers, > >> > >>Tim Leslie > >> > >>On Thu, 14 Apr 2005, Tim Leslie <ti...@cs...> wrote... > >> > >> > >>>On Wed, 13 Apr 2005, John Hunter <jdh...@ac...> wrote... > >>> > >>> > >>>>>>>>>"Tim" == Tim Leslie <ti...@cs...> writes: > >>>> > >>>> Tim> This all works fine except that the down key doesn't register > >>>> Tim> as released. After registering the down key press, no other > >>>> Tim> key events register until you hit the up key, at which point > >>>> Tim> the key release triggers for the up. > >>>> > >>>>It works fine for me -- what is your pygtk version and OS? > >>>>I'm using pygtk 2.2.0 on linux. > >>> > >>>AFAICT pygtk 2.0, this is running on ubuntu unstable. > >>> > >>> > >>>>You might put some debug print statements to print event.keyval in > >>>>_get_key to see if an event is being triggered at the gtk level. > >>> > >>>OK, I'll have a play with that. > >>> > >>> > >>>>Could it be a bad keyboard??? > >>> > >>>Yep :) Well, maybe. The down key works in every other app I use, but I've > >>>had problems with this keyboard in strange ways before, so I wouldn't put > >>>it past it. I'll try it out on another machine when I get a chance and > >>>see > >>>how it goes. It's a laptop, so I can't really change the keyboard. (hmm, > >>>maybe a usb external one, if I had one) > >>> > >>> > >>>> Tim> I really don't know a lot about Gtk or the matplotlib > >>>> Tim> internals so I couldn't trace this bug deeper into the > >>>> Tim> libraries. Can anyone shed some light on what's going on? If > >>>> Tim> we can get the arrow keys working is there a chance of > >>>> Tim> getting them into the standard distribution (assuming we had > >>>> Tim> all backends working)? > >>>> > >>>>Absolutely. It might be nice to enable some standard keyboard > >>>>navigation too. > >>> > >>>OK well I'll play around with this some more and I'll get back to you > >>>once > >>>I have what I think is a complete, working patch. > >>> > >>>Cheers, > >>> > >>>Tim Leslie > >>> > >>> > >>>>JDH > >>>> > >>> > >>>`- > >>> > >>> > >>>------------------------------------------------------- > >>>SF email is sponsored by - The IT Product Guide > >>>Read honest & candid reviews on hundreds of IT Products from real users. > >>>Discover which products truly live up to the hype. Start reading now. > >>>http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click > >>>_______________________________________________ > >>>Matplotlib-users mailing list > >>>Mat...@li... > >>>https://lists.sourceforge.net/lists/listinfo/matplotlib-users > >>> > >> > >>`- > >> > >> > >>------------------------------------------------------- > >>SF email is sponsored by - The IT Product Guide > >>Read honest & candid reviews on hundreds of IT Products from real users. > >>Discover which products truly live up to the hype. Start reading now. > >>http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click > >>_______________________________________________ > >>Matplotlib-users mailing list > >>Mat...@li... > >>https://lists.sourceforge.net/lists/listinfo/matplotlib-users > >> > > > >`- > > > > > >------------------------------------------------------- > >SF email is sponsored by - The IT Product Guide > >Read honest & candid reviews on hundreds of IT Products from real users. > >Discover which products truly live up to the hype. Start reading now. > >http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click > > > > > ------------------------------------------------------- > SF email is sponsored by - The IT Product Guide > Read honest & candid reviews on hundreds of IT Products from real users. > Discover which products truly live up to the hype. Start reading now. > http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > `- |