CallBack function in C Libraries.

fiensproto at gmail.com fiensproto at gmail.com
Fri Mar 21 13:02:28 CET 2014


> I'm afraid it doesn't help that GoogleGroups has badly mangled the  
> 
> formatting of your code.  I'm not quite sure what to suggest since it  
> 
> isn't one of the usual problems, but you might find reading  
> 
> https://wiki.python.org/moin/GoogleGroupsPython helpful.  It will  
> 
> certainly help with the double-spacing in your quote above.

> Rhodri James *-* Wildebeest Herder to the Masses


Yep, Many thanks for help....
Hum, i have find the solution, it was in "CallBack function" in help-doc.

=> 

#file fpgui-test.py
from ctypes import*

def TheProc():
    fpgui.fpgFormWindowTitle(0, 'Boum')
    return 0 

def TheProcBut0():
    fpgui.fpgButtonSetText(0,0, 'Boum also')
    return 0 
    
def TheProcBut1():
    fpgui.fpgButtonSetText(0,1, 'Boum too')
    return 0 
 
CMPFUNC = CFUNCTYPE(c_int)

TheProcF = CMPFUNC(TheProc)
TheProcB0 = CMPFUNC(TheProcBut0)
TheProcB1 = CMPFUNC(TheProcBut1)

fpgui = cdll.LoadLibrary("fpgui-32.dll")

fpgui.fpgInitialize()
fpgui.fpgSetStyle('Demo Style')
fpgui.fpgFormCreate(0, -1)
fpgui.fpgFormSetPosition(0, 300,100,400,200)
fpgui.fpgFormWindowTitle(0, 'Hello world!')

fpgui.fpgFormOnClick(0,TheProcF) 

fpgui.fpgButtonCreate(0,0,-1) ;
fpgui.fpgButtonSetPosition(0,0, 15, 10 , 150 , 40)
fpgui.fpgButtonSetText(0,0, 'BUTTON1')
fpgui.fpgButtonOnClick(0,0,TheProcB0) 

fpgui.fpgButtonCreate(0,1,-1) ;
fpgui.fpgButtonSetPosition(0,1, 15, 70 , 150, 40)
fpgui.fpgButtonSetText(0,1, 'Clickme')
fpgui.fpgButtonOnClick(0,1,TheProcB1)

fpgui.fpgFormShow(0)
fpgui.fpgRun()



More information about the Python-list mailing list