Passing additional arguments to python callback object (win32com.client.dispatchWithEvents) -


I am struggling with callback objects, I am a newbie. Please be good:

I Win32com package to interact with a windows application (application is not important)

What I am trying to achieve in a nutshell, this is a subscription on a table that updates.

I've successfully implemented a callback that gets data returned to the table update, but what I need to do now is to work on the data received.

It will be very easy to solve this problem if I can instantiate the callback object with additional arguments (see the code below), but how do I harm it.


callback class:

  class callback accents (object): "" "callback object for win32com" "def on new data (self, XMLData): logging Print the "{}" .form (XMLData)) # Want to use some logic to use logic # OnActionResult to use new data def (manually, Job, message): Return True Def OnServerDisconnect (self): logging .debug ("server disconnected") def onserver connectivity (Self): Logging. Debug ("Traders Connected to Server")  

Callback Object Instant:

  #InstantIEpt API Comm Object .app = win32com.client.DispatchWithEvents ("Windows Notification" callback events) #I want to give callback objects additional dargah Brainstorm Example Callback Accents (Parameter)  

Edit

Instant callback object:

  # two combs Quotes self.com1 = win32com.client.DispatchWithEvents ("WindowsApplication" callBackEvents) self.com2 = win32com.client.DispatchWithEvents ("WindowsApplication" callBackEvents) # Create multiple subscriptions (note that these are asynchronous) # Pushing subscription information There is no problem and has done elsewhere on its own. 1. Subscribe (& lt; subscription information & gt;) self.com2 Subscribe (& lt; Subscription information & gt;)  

Now when the membership information hits the callback object, I do not know which com object has been subscribed (I Based on this, but it is causing problems while setting up similar subscriptions)

Since your Nearly there is only one app instance and therefore a DispatchWithEvents , you can easily create parameters Members of the group:

  class callback accents (object): "" "callback object for win32com" params = any dnf on new data (... ... # parameter field callback Avents .params = yourParams self.app = win32com.client.DispatchWithEvents ("WindowsApplication", callBackEvents)  

You can definitely create a global consultation but you can only globals for the last resort Should be used in form or for constants.


Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -