1Metadata-Version: 1.0
2Name: PyUserInput
3Version: 0.1.11
4Summary: A simple, cross-platform module for mouse and keyboard control
5Home-page: https://github.com/PyUserInput/PyUserInput
6Author: Paul Barton <pablo.barton@gmail.com>, Pepijn de Vos <pepijndevos@gmail.com>
7Author-email: pablo.barton@gmail.com
8License: http://www.gnu.org/licenses/gpl-3.0.html
9Description: PyUserInput
10        ===========
11
12        A module for cross-platform control of the mouse and keyboard in python that is
13        simple to use.
14
15        Mouse control should work on Windows, Mac, and X11 (most Linux systems).
16        Scrolling is implemented, but users should be aware that variations may
17        exist between platforms and applications.
18
19        Keyboard control works on X11(linux) and Windows systems. Mac control is a work
20        in progress.
21
22        Dependencies
23        ------------
24
25        Depending on your platform, you will need the following python modules for
26        PyUserInput to function:
27
28          * Linux - Xlib
29          * Mac - Quartz, AppKit
30          * Windows - pywin32, pyHook
31
32        How to get started
33        ------------------
34
35        After installing PyUserInput, you should have pymouse and pykeyboard modules in
36        your python path. Let's make a mouse and keyboard object:
37
38        ```python
39
40        from pymouse import PyMouse
41        from pykeyboard import PyKeyboard
42
43        m = PyMouse()
44        k = PyKeyboard()
45        ```
46
47        Here's an example of clicking the center of the screen and typing "Hello, World!":
48
49        ```python
50
51        x_dim, y_dim = m.screen_size()
52        m.click(x_dim/2, y_dim/2, 1)
53        k.type_string('Hello, World!')
54        ```
55
56        PyKeyboard allows for a range of ways for sending keystrokes:
57
58        ```python
59
60        # pressing a key
61        k.press_key('H')
62        # which you then follow with a release of the key
63        k.release_key('H')
64        # or you can 'tap' a key which does both
65        k.tap_key('e')
66        # note that that tap_key does support a way of repeating keystrokes with a interval time between each
67        k.tap_key('l',n=2,interval=5)
68        # and you can send a string if needed too
69        k.type_string('o World!')
70        ```
71
72
73        and it supports a wide range of special keys:
74
75        ```python
76
77        #Create an Alt+Tab combo
78        k.press_key(k.alt_key)
79        k.tap_key(k.tab_key)
80        k.release_key(k.alt_key)
81
82        k.tap_key(k.function_keys[5])  # Tap F5
83        k.tap_key(k.numpad_keys['Home'])  # Tap 'Home' on the numpad
84        k.tap_key(k.numpad_keys[5], n=3)  # Tap 5 on the numpad, thrice
85        ```
86
87        Note you can also send multiple keystrokes together (e.g. when accessing a keyboard shortcut) using the press_keys method:
88
89        ```python
90
91        # Mac example
92        k.press_keys(['Command','shift','3'])
93        # Windows example
94        k.press_keys([k.windows_l_key,'d'])
95        ```
96
97        Consistency between platforms is a big challenge; Please look at the source for the operating system that you are using to help understand the format of the keys that you would need to send. For example:
98
99        ```python
100
101        # Windows
102        k.tap_key(k.alt_key)
103        # Mac
104        k.tap_key('Alternate')
105        ```
106
107        I'd like to make a special note about using PyMouseEvent and PyKeyboardEvent.
108        These objects are a framework for listening for mouse and keyboard input; they
109        don't do anything besides listen until you subclass them. I'm still formalizing
110        PyKeyboardEvent, so here's an example of subclassing PyMouseEvent:
111
112        ```python
113
114        from pymouse import PyMouseEvent
115
116        def fibo():
117            a = 0
118            yield a
119            b = 1
120            yield b
121            while True:
122                a, b = b, a+b
123                yield b
124
125        class Clickonacci(PyMouseEvent):
126            def __init__(self):
127                PyMouseEvent.__init__(self)
128                self.fibo = fibo()
129
130            def click(self, x, y, button, press):
131                '''Print Fibonacci numbers when the left click is pressed.'''
132                if button == 1:
133                    if press:
134                        print(self.fibo.next())
135                else:  # Exit if any other mouse button used
136                    self.stop()
137
138        C = Clickonacci()
139        C.run()
140        ```
141
142        Intended Functionality of Capturing in PyUserInput
143        --------------------------------------------------
144
145        For PyMouseEvent classes, the variables "capture" and "capture_move" may be
146        passed during instantiation. If `capture=True` is passed, the intended result
147        is that all mouse button input will go to your program and nowhere else. The
148        same is true for `capture_move=True` except it deals with mouse pointer motion
149        instead of the buttons. Both may be set simultaneously, and serve to prevent
150        events from propagating further. If you notice any bugs with this behavior,
151        please bring it to our attention.
152
153        A Short Todo List
154        -----------------
155
156        These are a few things I am considering for future development in
157        PyUserInput:
158
159         * Ensuring that PyMouse capturing works for all platforms
160         * Implement PyKeyboard capturing (add PyKeyboardEvent for Mac as well)
161         * PyMouse dynamic delta scrolling (available in Mac and Windows, hard to standardize)
162         * Make friends with more Mac developers, testing help is needed...
163
164
165        Many thanks to
166        --------------
167
168        [Pepijn de Vos](https://github.com/pepijndevos) - For making
169        [PyMouse](https://github.com/pepijndevos/PyMouse) and allowing me to modify
170        and distribute it along with PyKeyboard.
171
172        [Jack Grigg](https://github.com/pythonian4000) - For contributions to
173        cross-platform scrolling in PyMouse.
174
175Keywords: mouse,keyboard user input event
176Platform: UNKNOWN
177