problem in event handling on change of variable value.

sirjee hitechpundir at gmail.com
Sat Aug 1 05:22:28 EDT 2009


hello;

i m facing a problem in handling events on change of value of
environment variable in a tool CANoe.

class CANoeEvents:
    def OnChange(self,value):
        print "value of environment variable has changed"
    def OnOpen(self,App):
        print "opening Application"

App_Event = DispatchWithEvents('CANoe.Application',CANoeEvents)
time.sleep(2)
App_Event.Open("C:\projectConfig.cfg")  # printd "opening Application"
and event handled properly.
.......(now a code file runs in the canoe in which value of
environment variable called dummy is changed during execution. Just
like OnOpen; OnChange is defined in specification which should be
called on change of environment variable.But it is not happening.)
while (<some condition>):
                myenvVar = App_Event.Environment.GetVariable("dummy")

The VB does it very easily and defines a subroutine called :
Sub myenvVar _OnChange(value)
   print "value of environment variable has changed"
End Sub
//////////////////////////////////////////////////however the
alternative for subroutine for OnOpen in VB (defined below) works fine
as shown above in python.
Sub AppEvent_OnOpen(App)
        print "opening Application"
End Sub

for VB; all this stuff is cake work.... object_eventname subroutine
and done.....what in python?



More information about the Python-list mailing list