A package that allows to cancel, certain functions that can be a pain, when working with threading.
Project description
Installation
pip install cancelable
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-0.0.3.tar.gz
(7.9 kB
view hashes)
Built Distribution
Close
Hashes for cancelable-0.0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 078ba9f506f5ab448a4d9a802dd3a3825a1ae3e7105cf602ea2717393c741067 |
|
MD5 | 891514bea3cb79e0540d388be8969b97 |
|
BLAKE2b-256 | b8e726695a3ba657382387cce5ab06d3f30704f152520add488df396ba8116a1 |