A package that allows to cancel, certain functions that can be a pain, when working with threading.
Project description
Installation
pip install cancelable-py
Usage
Without the normal time package:
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:
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()
To do
Add more functions such as input()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
cancelable-py-0.0.2.tar.gz
(7.8 kB
view hashes)
Built Distribution
Close
Hashes for cancelable_py-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a75915c2bc5f98d470e58d951f9c99c46ba1d69ec1aba7bd21e740937e14d86e |
|
MD5 | ba4a98aed29e98636d1d158635c20503 |
|
BLAKE2b-256 | a8f19496dba1c414e17845f0d14567ce260324d311322ddbcc13fb50ee1e38ef |