U
    Pe                     @   s0   d Z ddlmZ dZdd Zdd Zdd	 Zd
S )a  Keybinding
==========

This module forces the mapping of some keys to functions:

* F11: Rotate the Window through 0, 90, 180 and 270 degrees
* Shift + F11: Switches between portrait and landscape on desktops
* F12: Take a screenshot

Note: this doesn't work if the application requests the keyboard beforehand.

Usage
-----

For normal module usage, please see the :mod:`~kivy.modules` documentation.

The Keybinding module, however, can also be imported and used just
like a normal python module. This has the added advantage of being
able to activate and deactivate the module programmatically::

    from kivy.app import App
    from kivy.uix.button import Button
    from kivy.modules import keybinding
    from kivy.core.window import Window

    class Demo(App):

        def build(self):
            button = Button(text="Hello")
            keybinding.start(Window, button)
            return button

    Demo().run()

To remove the Keybinding, you can do the following::

    Keybinding.stop(Window, button)

    )platform)startstopc                 C   s|   |dkr|g kr|    n^|dkr:|g kr:|  jd7  _n>|dkrx|dgkrxtdkrxd| _| j\}}|| }}||f| _d S )Ni%  i$  Z   shift)winlinuxmacosxr   )Z
screenshotZrotationr   size)instancekeyZscancode	codepoint	modifierswh r   ;/tmp/pip-unpacked-wheel-xzebddm3/kivy/modules/keybinding.py_on_keyboard_handler.   s    


r   c                 C   s   | j td d S N)Zon_keyboard)bindr   r   ctxr   r   r   r   ;   s    r   c                 C   s   | j td d S r   )Zunbindr   r   r   r   r   r   ?   s    r   N)__doc__Z
kivy.utilsr   __all__r   r   r   r   r   r   r   <module>   s
   (