Debian Codegraph @

examples/events_example.py

raw symbols SCIP
1 # This example demonstrates the use of pyotherside.send() to send events to Qt.
2
3 import pyotherside
4
5 import threading
6 import time
7
8 print('Using PyOtherSide version', pyotherside.version)
9
10 COLORS = ['red', 'green', 'blue']
11
12 def thread_func():
13 i = 0
14 while True:
15 pyotherside.send('append', 'Next Number: ', i)
16 if i % 2 == 0:
17 color = COLORS[int((i / 2) % len(COLORS))]
18 pyotherside.send('color', color)
19 i += 1
20 time.sleep(1)
21
22 thread = threading.Thread(target=thread_func)
23 thread.start()