Skip to main content

A tool when you have one more threading in a program and need to print.

Project description

PyGlobalPrinter

Intro

When a python program have more than one threading, you should use a printer to manage output print to prevent them output in the same time.

Code an Usage:

import time
import threading
class printer:
    def __init__(self):
        self.obj = []
        self.running = 1
    def run(self):
        while self.running:
            if self.obj: print(self.obj.pop(0))
            time.sleep(0.01)
    def add(self,stg):
        self.obj.append(stg)
    def main(self):
        threading.Thread(target=self.run, args=(),daemon=1).start()
    def stop(self):
        self.running = 0

pr = printer()
pr.main()

Print

pr.add(text)

Stop

pr.stop()

LICENSE:

Attribution 4.0 International

Copyright (c) 2025 wayne931121

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyglobalprinter-0.0.1.tar.gz (7.8 kB view details)

Uploaded Source

File details

Details for the file pyglobalprinter-0.0.1.tar.gz.

File metadata

  • Download URL: pyglobalprinter-0.0.1.tar.gz
  • Upload date:
  • Size: 7.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for pyglobalprinter-0.0.1.tar.gz
Algorithm Hash digest
SHA256 5c169fc27f78c531f0bad977c22f742e15a0a447538770993ad617e61af9d9ab
MD5 01148b69933d694f7de335e6998f21d8
BLAKE2b-256 05bdc1cf07d6f8eac258efa33343310deb1171333b94309a90b1aca24888b5a2

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page