| 1 |
import threading |
| 2 |
import time |
| 3 |
import pyotherside |
| 4 |
|
| 5 |
|
| 6 |
unbound = pyotherside.QObject() |
| 7 |
print(unbound) |
| 8 |
try: |
| 9 |
unbound.a = 1 |
| 10 |
except Exception as e: |
| 11 |
print('Got exception:', e) |
| 12 |
|
| 13 |
def do_something(bar): |
| 14 |
while True: |
| 15 |
print('got: ', bar.dynamicFunction(1, 2, 3)) |
| 16 |
time.sleep(1) |
| 17 |
|
| 18 |
def foo(bar, py): |
| 19 |
|
| 20 |
|
| 21 |
print('got:', bar, py) |
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
print(py.evaluate) |
| 27 |
print(py.evaluate('3*3')) |
| 28 |
|
| 29 |
try: |
| 30 |
bar.i_am_pretty_sure_this_attr_does_not_exist = 147 |
| 31 |
except Exception as e: |
| 32 |
print('Got exception (as expected):', e) |
| 33 |
|
| 34 |
try: |
| 35 |
bar.x = 'i dont think i can set this to a string' |
| 36 |
except Exception as e: |
| 37 |
print('Got exception (as expected):', e) |
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
try: |
| 42 |
bar.dynamicFunction(bar.dynamicFunction, 2, 3) |
| 43 |
except Exception as e: |
| 44 |
print('Got exception (as expected):', e) |
| 45 |
|
| 46 |
|
| 47 |
print(bar.x, bar.color, bar.scale) |
| 48 |
bar.x *= 3 |
| 49 |
|
| 50 |
|
| 51 |
print(bar.dynamicFunction) |
| 52 |
|
| 53 |
|
| 54 |
result = bar.dynamicFunction(1, 2, 3) |
| 55 |
print('result:', result) |
| 56 |
|
| 57 |
try: |
| 58 |
bar.dynamicFunction(1, 2, 3, unexpected=123) |
| 59 |
except Exception as e: |
| 60 |
print('Got exception (as expected):', e) |
| 61 |
|
| 62 |
threading.Thread(target=do_something, args=[bar]).start() |
| 63 |
|
| 64 |
|
| 65 |
return bar |