Thread

Создавайте несколько потоков, и управляйте ими.

thread

class thread(target: Callable, args: Tuple = (), kwargs: Dict = {}):

start

def start(self) -> None:

stop

def stop(self) -> None:

is_running

def is_running(self) -> bool:

Пример использования:

def test(word, name):
    while True:
        print(f"Hello {word}, from {name}")
        time.sleep(1)

my_thread = thread(test, args=("world", "Igor"))
my_thread.start()

while True:
    print("Main thread working too...")
    time.sleep(1)
    pass

Last updated