focus.py 507 B

1234567891011121314151617181920212223242526
  1. from __future__ import annotations
  2. from prompt_toolkit.key_binding.key_processor import KeyPressEvent
  3. __all__ = [
  4. "focus_next",
  5. "focus_previous",
  6. ]
  7. E = KeyPressEvent
  8. def focus_next(event: E) -> None:
  9. """
  10. Focus the next visible Window.
  11. (Often bound to the `Tab` key.)
  12. """
  13. event.app.layout.focus_next()
  14. def focus_previous(event: E) -> None:
  15. """
  16. Focus the previous visible Window.
  17. (Often bound to the `BackTab` key.)
  18. """
  19. event.app.layout.focus_previous()