cancelable-0.0.4
توضیحات
A package that allows to cancel, certain functions that can be a pain, when working with threading.
| ویژگی | مقدار |
|---|---|
| سیستم عامل | Unix |
| نام فایل | cancelable-0.0.4 |
| نام | cancelable |
| نسخه کتابخانه | 0.0.4 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | jona799t |
| ایمیل نویسنده | - |
| آدرس صفحه اصلی | https://github.com/jona799t/Cancelable |
| آدرس اینترنتی | https://pypi.org/project/cancelable/ |
| مجوز | - |
# Installation
```
pip install cancelable
```
# Usage
Without the normal time package:
## Sleep
```python
from cancelable import time
import threading
def count():
i = 1
while True:
time.sleep(1)
print(i)
i += 1
threading._start_new_thread(count, ())
input("Click enter to cancel counting\n")
time.cancel()
```
With the normal time package:
```python
from cancelable import time as cancelableTime
import threading
def count():
i = 1
while True:
cancelableTime.sleep(1)
print(i)
i += 1
threading._start_new_thread(count, ())
input("Click enter to cancel counting\n")
cancelableTime.cancel()
```
## Input
```python
from cancelable import time, input, cancelInput
import threading
name = ""
def ask():
global name
name = input("Your name: ")
time.cancel()
threading._start_new_thread(ask, ())
time.sleep(5)
cancelInput()
print(name)
```
# To do
Add more functions such as input()
نحوه نصب
نصب پکیج whl cancelable-0.0.4:
pip install cancelable-0.0.4.whl
نصب پکیج tar.gz cancelable-0.0.4:
pip install cancelable-0.0.4.tar.gz