tests/python/python@py_ext/py_ext.xml
changeset 1099 d9c28879e55b
parent 1098 0ead830daf26
child 1100 1f46424c6220
equal deleted inserted replaced
1098:0ead830daf26 1099:d9c28879e55b
     1 <?xml version="1.0" encoding="UTF-8" standalone="no"?>
       
     2 <Python xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.w3.org/2001/XMLSchema" xsi:schemaLocation="py_ext_xsd.xsd">
       
     3 <![CDATA[import time,sys,ctypes
       
     4 Python_to_C_Call = PLCBinary.Python_to_C_Call
       
     5 Python_to_C_Call.restype = ctypes.c_int
       
     6 Python_to_C_Call.argtypes = [ctypes.c_int, ctypes.POINTER(ctypes.c_int)]
       
     7 
       
     8 def MyPythonFunc(arg):
       
     9     i = ctypes.c_int()
       
    10     if(Python_to_C_Call(arg, i)):
       
    11         res = i.value
       
    12         print "toC:", arg, "from C:", res, "FBID:", FBID
       
    13     else:
       
    14         print "Failed Python_to_C_Call failed"
       
    15         res = None
       
    16     sys.stdout.flush()
       
    17     return res
       
    18 
       
    19 async_error_test_code = """
       
    20 def badaboom():
       
    21     tuple()[0]
       
    22 
       
    23 import wx
       
    24 def badaboomwx():
       
    25     wx.CallAfter(badaboom)
       
    26 
       
    27 from threading import Timer
       
    28 a = Timer(3, badaboom)
       
    29 a.start()
       
    30 
       
    31 b = Timer(6, badaboomwx)
       
    32 b.start()
       
    33 """
       
    34 ]]>
       
    35 </Python>