Subversion Repositories f9daq

Rev

Rev 143 | Blame | Compare with Previous | Last modification | View Log | RSS feed

import os
print(os.getcwd())
#import sys
#sys.stdout = sys.stderr = open("log_file.txt", "w")
from ctypes import *
from time import time,ctime,sleep
print( 'gui executed on ',ctime(time()))

# zal tole ne dela. Bilo bi najbolj enostavno, ker ne bi bilo treba delati posebnih knjiznic
#cvi = cdll.LoadLibrary(r"C:\Program Files (x86)\National Instruments\CVI2013\cvi")
#cvi = cdll.LoadLibrary("C:/Users/rok/Documents/rok/lab/CVIPython/cvi")
#cvi = cdll.LoadLibrary("cvi")

mylib = cdll.LoadLibrary(r"ExportCVIFunctions")
mylib.pySetCtrlVal.argtypes = [c_char_p , c_char_p ]
#mylib.pyGetCtrlVal.argtypes = [c_char_p , POINTER(c_int) ]

mylib.pyProcessUserEvent.argtypes = [c_char_p ]
mylib.pyQueueUserEvent.argtypes = [c_char_p ]  
mylib.pyGetCtrlVal.argtypes = [c_char_p , c_void_p ]

retval= mylib.pySetPanelHandle(panel)

values =  c_int()

retval= mylib.pyPrint(10)
retval= mylib.pySetPanelHandle(panel)
retval= mylib.pySetQueueHandle(queue)  
retval= mylib.pyLoadUirHeader(b"TestGui.h");

retval= mylib.pySetCtrlVal(b"PANEL_TXT", b"A E C" )  
retval= mylib.pyGetCtrlVal(b"PANEL_X0", byref(values) )

print("GetCtrlVal")
print(values)


mdate = create_string_buffer(32)
retval= mylib.pyGetCtrlVal(b"PANEL_TXT", mdate )

print("GetCtrlVal")
print(mdate.value)

#retval= mylib.pyQueueUserEvent(b"PANEL_TEST" )
retval= mylib.pyProcessUserEvent(b"PANEL_TEST" )

def greet(name):
    print( 'Hello', name )
greet('Jack')
greet('Jill')
greet('Bob')



for i in range(3):
  retval= mylib.pySetCtrlVal(b"PANEL_TXT", bytes( ctime(time()), 'utf-8') )
  retval= mylib.pySetCtrlVal(b"PANEL_NUMERIC",  bytes( "{}".format(i), 'utf-8') )  
  sleep(2)

retval= mylib.pyQueueUserEvent(b"PANEL_START" )