2014-02-06 21:31:24 +01:00
|
|
|
# This example demonstrates the use of pyotherside.send() to send events to Qt.
|
2013-08-07 21:47:24 +02:00
|
|
|
|
|
|
|
import pyotherside
|
|
|
|
|
|
|
|
import threading
|
|
|
|
import time
|
|
|
|
|
2014-02-19 22:09:52 +01:00
|
|
|
print('Using PyOtherSide version', pyotherside.version)
|
|
|
|
|
2013-08-07 21:47:24 +02:00
|
|
|
COLORS = ['red', 'green', 'blue']
|
|
|
|
|
|
|
|
def thread_func():
|
|
|
|
i = 0
|
|
|
|
while True:
|
|
|
|
pyotherside.send('append', 'Next Number: ', i)
|
|
|
|
if i % 2 == 0:
|
|
|
|
color = COLORS[int((i / 2) % len(COLORS))]
|
|
|
|
pyotherside.send('color', color)
|
|
|
|
i += 1
|
|
|
|
time.sleep(1)
|
|
|
|
|
|
|
|
thread = threading.Thread(target=thread_func)
|
|
|
|
thread.start()
|