Metadata-Version: 2.1
Name: PyHotKey
Version: 1.3.2
Summary: A cross-platform hot key module.
Home-page: https://github.com/Xpp521/PyHotKey
Author: Xpp
Author-email: Xpp233@foxmail.com
License: LGPLv3
Project-URL: Documentation, https://github.com/Xpp521/PyHotKey/wiki
Project-URL: Source, https://github.com/Xpp521/PyHotKey
Project-URL: Tracker, https://github.com/Xpp521/PyHotKey/issues
Keywords: hotkey,hot,key
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Operating System :: OS Independent
Classifier: Operating System :: MacOS :: MacOS X
Classifier: Operating System :: Microsoft :: Windows :: Windows NT/2000
Classifier: Operating System :: POSIX
Classifier: License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Description-Content-Type: text/markdown
Requires-Dist: pynput (>=1.6.0)

# PyHotKey
### Description
PyHotKey is a cross-platform hot key module for Python. Based on [pynput](https://github.com/moses-palmer/pynput) library.

### Installation
#### Using pip:
```
pip install PyHotKey
```
#### Using easy_install:
```
easy_install PyHotKey
```
#### From source file:
a) Download a zip file or a tar.gz file from [GitHub](https://github.com/Xpp521/PyHotKey/releases) or [PyPI](https://pypi.org/project/PyHotKey/#files);  
b) Extract the file to a directory;  
c) Navigate a terminal session to the directory that contains setup.py;  
d) Execute the command below.
```
python setup.py install
```
Tip: if you are using Linux, you may need to prepend the command with sudo.

### Usage
#### Importation:
```python
from PyHotKey import manager, Key
```

#### Register:
##### a) prototype:
```python
def RegisterHotKey(self, trigger, keys, count=2, interval=0.5, *args, **kwargs):
    """
    :param trigger: the function invoked when the hot key is triggered.
    :param list keys: the key list.
    :param int count: the number of repeated keystrokes.
    :param float interval: the interval time between each keystroke, unit: second.
    :param args: the arguments of trigger.
    :param kwargs: the keyword arguments of trigger.
    :return: returns a key id if successful; otherwise returns -1.
    """
    pass
```

##### b) Example:
```python
# combination type hot key
key_id1 = manager.RegisterHotKey(func1, [Key.ctrl_l, Key.alt_l, 'z'])

# single keystroke type hot key
key_id2 = manager.RegisterHotKey(func2, [Key.caps_lock], 2, 0.5,
                                 func2_arg1, func2_arg2=1)
```

#### Unregister:
```python
result = manager.UnregisterHotKey(key_id1)
```

#### View hotkey list:
```python
print(manager.hotKeyList)
```

#### Logger:
```python
# Turn on the logger
manager.logger = True

# custom the log path
manager.setLogPath('MyLog.log')

# Turn off the logger
manager.logger = False
```
# Release Note
## v1.3.2
#### Bug Fixes:
- Log path: fix the default log path overwrites the custom log path when setting "manager.logger = True".
#### Refactor
- Adjust code structure.
- Rewrite README.md.
## v1.3.1
- Delete a deprecated class.
- Replace root logger with a separate logger.
- Rename property "hot_keys" to "hotKeyList".
- Change documents and some code comments.
## v1.3.0
- Currently, users can customize the log path.
- Optimize code.
## v1.2.0
- Add logger.
- Optimize code.
- Attempt to fix a potential bug.
## v1.1.1
- Remove log message.
## v1.1.0
- Currently, the trigger function supports arguments.
- No longer need to call manager.start() manually.
- Fix multiple type hot key bug.
## v1.0
- The first version.

