conflicts with navigation bar events

Hi all!

How can I use the keyboard events up/down/right/left without starting an interaction with the navigation toolbar?
I connected to the keypress events and everything looks ok until I press the down key: my connected method gets called once and the navigation toolbar then gets the focus. From that point on it catches all of my arrow presses.
I noticed that using shifted keys could be a workaround but I really do not like it...

Thanks in advance for help!

cheers JF

···

-
Helmholtz Zentrum Geesthacht
Institut für Werkstoffforschung
Abteilung WPN, Instrument REFSANS
Lichtenbergstr. 1
85747 Garching FRM II
Tel.: +49 (0)89 289 10762
Internet: http://www.frm2.tum.deHelmholtz-Zentrum Geesthacht
Zentrum für Material- und Küstenforschung GmbH
Max-Planck-Straße 1 I 21502 Geesthacht I Deutschland/Germany

Geschäftsführer/Board of Management: Prof. Dr. Wolfgang Kaysser, Dipl.-Ing. Michael Ganß
Vorsitzender des Aufsichtsrates/Chairman of the Supervisory Board: MinDirig Wilfried Kraus
Amtsgericht Lübeck HRB 285 GE (Register Court)
Internet: http://www.hzg.de

Yeah, this is annoying. A quick way out is to hit the ESC button. Took me forever to figure that out.

The more permanent fix is to remove the ‘up’ and ‘down’ events from the default key maps. I have some code that needed their own keymap and I checked for collisions with the default keymap:

https://github.com/WeatherGod/BRadar/blob/master/lib/BRadar/plotutils.py#L408

Might be overkill for what you need, but you should get the idea.

Cheers!
Ben Root

···

On Mon, Jul 2, 2012 at 4:33 AM, <Jean-Francois.Moulin@…4126…> wrote:

Hi all!

How can I use the keyboard events up/down/right/left without starting an interaction with the navigation toolbar?

I connected to the keypress events and everything looks ok until I press the down key: my connected method gets called once and the navigation toolbar then gets the focus. From that point on it catches all of my arrow presses.

I noticed that using shifted keys could be a workaround but I really do not like it…

Thanks in advance for help!

cheers JF

Hi Ben,

thanks for the tip!
I nevertheless hit another snag:
In [12]: [(k,p.rcParams[k]) for k in p.rcParams.keys() if 'keymap' in k]
Out[12]:
[('keymap.all_axes', ['a']),
('keymap.back', ['left', 'c', 'backspace']),
('keymap.forward', ['right', 'v']),
('keymap.fullscreen', ['f']),
('keymap.grid', ['g']),
('keymap.home', ['h', 'r', 'home']),
('keymap.pan', ['p']),
('keymap.save', ['s']),
('keymap.xscale', ['k', 'L']),
('keymap.yscale', ['l']),
('keymap.zoom', ['o'])]

Meaning that up and down ar not in the mapping... Any clue?
Thanks again
Cheers
JF

···

-
Helmholtz Zentrum Geesthacht
Institut für Werkstoffforschung
Abteilung WPN, Instrument REFSANS
Lichtenbergstr. 1
85747 Garching FRM II
Tel.: +49 (0)89 289 10762
Internet: http://www.frm2.tum.de

-----ben.v.root@...287... schrieb: -----
An: Jean-Francois.Moulin@...4126...
Von: Benjamin Root
Gesendet von: ben.v.root@...287...
Datum: 07/03/2012 06:29PM
Kopie: matplotlib-users@lists.sourceforge.net
Betreff: Re: [Matplotlib-users] conflicts with navigation bar events

On Mon, Jul 2, 2012 at 4:33 AM, <Jean-Francois.Moulin@...4126...> wrote:
  Hi all!

How can I use the keyboard events up/down/right/left without starting an interaction with the navigation toolbar?
I connected to the keypress events and everything looks ok until I press the down key: my connected method gets called once and the navigation toolbar then gets the focus. From that point on it catches all of my arrow presses.
   I noticed that using shifted keys could be a workaround but I really do not like it...

Thanks in advance for help!

cheers JF

Yeah, this is annoying. A quick way out is to hit the ESC button. Took me forever to figure that out.

The more permanent fix is to remove the 'up' and 'down' events from the default key maps. I have some code that needed their own keymap and I checked for collisions with the default keymap:
  
https://github.com/WeatherGod/BRadar/blob/master/lib/BRadar/plotutils.py#L408

Might be overkill for what you need, but you should get the idea.
  
Cheers!
Ben Root

Helmholtz-Zentrum Geesthacht
Zentrum für Material- und Küstenforschung GmbH
Max-Planck-Straße 1 I 21502 Geesthacht I Deutschland/Germany

Geschäftsführer/Board of Management: Prof. Dr. Wolfgang Kaysser, Dipl.-Ing. Michael Ganß
Vorsitzender des Aufsichtsrates/Chairman of the Supervisory Board: MinDirig Wilfried Kraus
Amtsgericht Lübeck HRB 285 GE (Register Court)
Internet: http://www.hzg.de

Right, I forgot about that. I am trying to dig through my code to figure out what I did to make this problem go away. In the meantime, does hitting “ESC” at least get you around the problem?

Ben Root

···

On Wed, Jul 4, 2012 at 3:15 AM, <Jean-Francois.Moulin@…4126…> wrote:

Hi Ben,

thanks for the tip!

I nevertheless hit another snag:

In [12]: [(k,p.rcParams[k]) for k in p.rcParams.keys() if ‘keymap’ in k]

Out[12]:

[(‘keymap.all_axes’, [‘a’]),

(‘keymap.back’, [‘left’, ‘c’, ‘backspace’]),

(‘keymap.forward’, [‘right’, ‘v’]),

(‘keymap.fullscreen’, [‘f’]),

(‘keymap.grid’, [‘g’]),

(‘keymap.home’, [‘h’, ‘r’, ‘home’]),

(‘keymap.pan’, [‘p’]),

(‘keymap.save’, [‘s’]),

(‘keymap.xscale’, [‘k’, ‘L’]),

(‘keymap.yscale’, [‘l’]),

(‘keymap.zoom’, [‘o’])]

Meaning that up and down ar not in the mapping… Any clue?

Thanks again

Cheers
JF

Hi Ben !

nope, ESC does not help.
By the way do you have any tip on working with key modifiers?

Thanks a lot,

Best
JF

···

-
Helmholtz Zentrum Geesthacht
Institut für Werkstoffforschung
Abteilung WPN, Instrument REFSANS
Lichtenbergstr. 1
85747 Garching FRM II
Tel.: +49 (0)89 289 10762
Internet: http://www.frm2.tum.de

-----ben.v.root@...287... schrieb: -----
An: Jean-Francois.Moulin@...4126...
Von: Benjamin Root
Gesendet von: ben.v.root@...287...
Datum: 07/06/2012 07:32PM
Kopie: matplotlib-users@lists.sourceforge.net
Betreff: Re: [Matplotlib-users] conflicts with navigation bar events

Right, I forgot about that. I am trying to dig through my code to figure out what I did to make this problem go away. In the meantime, does hitting "ESC" at least get you around the problem?
  
Ben Root

-----------------------------------------

On Wed, Jul 4, 2012 at 3:15 AM, <Jean-Francois.Moulin@...4126...> wrote:
  Hi Ben,

thanks for the tip!
I nevertheless hit another snag:
In [12]: [(k,p.rcParams[k]) for k in p.rcParams.keys() if 'keymap' in k]
Out[12]:
[('keymap.all_axes', ['a']),
('keymap.back', ['left', 'c', 'backspace']),
('keymap.forward', ['right', 'v']),
('keymap.fullscreen', ['f']),
('keymap.grid', ['g']),
('keymap.home', ['h', 'r', 'home']),
('keymap.pan', ['p']),
('keymap.save', ['s']),
('keymap.xscale', ['k', 'L']),
('keymap.yscale', ['l']),
('keymap.zoom', ['o'])]

Meaning that up and down ar not in the mapping... Any clue?
Thanks again
Cheers

JF

Helmholtz-Zentrum Geesthacht
Zentrum für Material- und Küstenforschung GmbH
Max-Planck-Straße 1 I 21502 Geesthacht I Deutschland/Germany

Geschäftsführer/Board of Management: Prof. Dr. Wolfgang Kaysser, Dipl.-Ing. Michael Ganß
Vorsitzender des Aufsichtsrates/Chairman of the Supervisory Board: MinDirig Wilfried Kraus
Amtsgericht Lübeck HRB 285 GE (Register Court)
Internet: http://www.hzg.de