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-0.0.2.tar.gz
(7.9 kB
view hashes)
Built Distribution
Close
Hashes for cancelable-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 37ebe666c2ba8648fb0103a816d0a0f813683e738729c52a0935d32496081376 |
|
MD5 | 5cd7f89b62c6adf243a2838cb7e7d3ba |
|
BLAKE2b-256 | e08d567b239e138c828da0c7f8de439701b1bdb48791d42151519efaff92d08b |