Key Press event is captured by the Window, not just the plot area.

Issue #12 resolved
Juan Pablo Caram repo owner created an issue

No description provided.

Comments (3)

  1. Juan Pablo Caram reporter

    At creation time of the canvas:

    self.canvas.set_can_focus(True)
    

    And in "on_click" handler (or wherever/whenever desired):

    self.canvas.grab_focus()
    

    Then the key event will be handled appropriately with either connect() or mpl_connect(). This was simpler than what is described for C.

  2. Juan Pablo Caram reporter

    Could be desirable to also handle the focus_in/focus_out to show in the GUI that the drawing area has the focus:

     self.canvas.connect('focus_in_event', on_focus_in)
     self.canvas.connect('focus_out_event', on_focus_out)
    
  3. Log in to comment