[vbox-dev] How to create an object implementing VirtualBoxCallback from python?

Nikolay Igotti Nikolay.Igotti at Sun.COM
Sun Jun 14 16:40:12 GMT 2009


    Hi Francisco,

 Few days ago generic mechanism was implemented  for callback handlers 
creation, see function createCallback() in VirtualBoxManager.
One can use it like this:

class MyCallback
    def onMachineStateChange (self, ...):
       ....
   # implement all  methods of IVirtualBoxCallback here

 cb = mgr.createCallback('IVirtualBoxCallback', MyCallback)
 mgr.vbox.registerCallback(cb)

This approach shall work for both XPCOM and MS COM targets.

  Thanks,
    Nikolay

Francisco J. Vázquez пишет:
> Hi,
>
> I'm finishing the migration of my program from ugly hacks to the
> python api provided by virtualbox. The only thing left is being able
> to register callbacks. I assume I have to create an object
> implementing the VirtualBoxCallback interface, assign a function to
> the onMachineStateChange (or wathever event I want to monitor)
> variable and pass that object to registerCallback. Is this possible to
> do this in python? If so, how can it be done?
>
> Thanks
>   





More information about the vbox-dev mailing list