I have some problem:
There is a about 100 threads, they doing someth, but bad piece of cake in this:
print color("HEY - Some text ... :DDD blabla - "+strftime("%X", gmtime()),fg=85)
How can I fix it ? Or why it is happening?
I have some problem:
There is a about 100 threads, they doing someth, but bad piece of cake in this:
print color("HEY - Some text ... :DDD blabla - "+strftime("%X", gmtime()),fg=85)
How can I fix it ? Or why it is happening?
If you are only interested in the formatting, then I would add a newline to your print statement.
print color("HEY - Some text ... :DDD blabla - "+strftime("%X", gmtime())+"\n",fg=85)
Don't think it's possible to fix this in threads. You need one thread that will control output, your threads will send messages to this thread so that thread will handle all printing.
You can use Queue object for this (below quite modified example from documentation)
from threading import Thread
from Queue import Queue
from time import gmtime, strftime
def worker():
while True:
item = q.get()
print item
q.task_done()
q = Queue()
for i in range(1):
t = Thread(target=worker)
t.daemon = True
t.start()
# ---- Somewhere in your threads
q.put( color("HEY - Some text ... :DDD blabla - "+strftime("%X", gmtime()),fg=85) )
# -----
q.join()