How to use addPythonButton() and CvPopupInterface.py

zx1111

Warlord
Joined
Oct 31, 2005
Messages
235
Does any one know how to use addPythonButton() and CvPopupInterface.py?

I have .../screen/MyTestPopup.py" and .../entrypoint/CvPopupInterface.py" files in ".../CustomAssets/python" folder.

Code:
in "MyTestPopup.py":
.....
import Popup as PyPopup
mypopup=PyPopup.PyPopup()
.....
strFunctionName = "myTestHandler"
strButtonText = "Test Me"
strHelpText = ""
strArtPointer = r"Art\Interface\Popups\PopupRadioButton.kfm", 
iData1 = 123 ;  iData2 = 456;  bOption = True

mypopup.addPythonButton( strFunctionName, strButtonText, strHelpText, \
            strArtPointer, iData1, iData2, bOption)
mypopup.launch(True, PopupStates.POPUPSTATE_IMMEDIATE)
....

in "CvPopupInterface.py":
....
import CvUtil
def myTestHandler(args):         # global function.
	CvUtil.pyPrint("TEST POPUP CALLED")
	return 1
....
According to comment in CvPopupInterface.py, Pressing the "Test Me" button on my Popup
should call myTestHandler() in CvPopupInterface.py. But this does not work..
I enabled logging and Python Error display. But regarding this code, no error message is logged.
I tried def myTestHandler(*args): and def myTestHandler(iData1, iData2): but I got same result.
What should I do?
 
Back
Top Bottom