Rev 143 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
143 | f9daq | 1 | import os |
2 | print(os.getcwd()) |
||
3 | #import sys |
||
4 | #sys.stdout = sys.stderr = open("log_file.txt", "w") |
||
5 | from ctypes import * |
||
6 | from time import time,ctime,sleep |
||
7 | print( 'gui executed on ',ctime(time())) |
||
8 | |||
9 | # zal tole ne dela. Bilo bi najbolj enostavno, ker ne bi bilo treba delati posebnih knjiznic |
||
10 | #cvi = cdll.LoadLibrary(r"C:\Program Files (x86)\National Instruments\CVI2013\cvi") |
||
11 | #cvi = cdll.LoadLibrary("C:/Users/rok/Documents/rok/lab/CVIPython/cvi") |
||
12 | #cvi = cdll.LoadLibrary("cvi") |
||
13 | |||
14 | mylib = cdll.LoadLibrary(r"ExportCVIFunctions") |
||
15 | mylib.pySetCtrlVal.argtypes = [c_char_p , c_char_p ] |
||
16 | #mylib.pyGetCtrlVal.argtypes = [c_char_p , POINTER(c_int) ] |
||
17 | |||
18 | mylib.pyProcessUserEvent.argtypes = [c_char_p ] |
||
19 | mylib.pyQueueUserEvent.argtypes = [c_char_p ] |
||
20 | mylib.pyGetCtrlVal.argtypes = [c_char_p , c_void_p ] |
||
21 | |||
22 | retval= mylib.pySetPanelHandle(panel) |
||
23 | |||
24 | values = c_int() |
||
25 | |||
26 | retval= mylib.pyPrint(10) |
||
27 | retval= mylib.pySetPanelHandle(panel) |
||
28 | retval= mylib.pySetQueueHandle(queue) |
||
29 | retval= mylib.pyLoadUirHeader(b"TestGui.h"); |
||
30 | |||
31 | retval= mylib.pySetCtrlVal(b"PANEL_TXT", b"A E C" ) |
||
32 | retval= mylib.pyGetCtrlVal(b"PANEL_X0", byref(values) ) |
||
33 | |||
34 | print("GetCtrlVal") |
||
35 | print(values) |
||
36 | |||
37 | |||
38 | mdate = create_string_buffer(32) |
||
39 | retval= mylib.pyGetCtrlVal(b"PANEL_TXT", mdate ) |
||
40 | |||
41 | print("GetCtrlVal") |
||
42 | print(mdate.value) |
||
43 | |||
44 | #retval= mylib.pyQueueUserEvent(b"PANEL_TEST" ) |
||
45 | retval= mylib.pyProcessUserEvent(b"PANEL_TEST" ) |
||
46 | |||
47 | def greet(name): |
||
48 | print( 'Hello', name ) |
||
49 | greet('Jack') |
||
50 | greet('Jill') |
||
51 | greet('Bob') |
||
52 | |||
53 | |||
54 | |||
55 | for i in range(3): |
||
56 | retval= mylib.pySetCtrlVal(b"PANEL_TXT", bytes( ctime(time()), 'utf-8') ) |
||
57 | retval= mylib.pySetCtrlVal(b"PANEL_NUMERIC", bytes( "{}".format(i), 'utf-8') ) |
||
58 | sleep(2) |
||
59 | |||
60 | retval= mylib.pyQueueUserEvent(b"PANEL_START" ) |