Hello,
QuickOPC is exposed to Python via COM, and consuming COM events from Python has turned out to be quite problematic. It might be possible, but you are on your own, currently.
Instead, we suggest to use the "event pull mechanism" - see
opclabs.doc-that.com/files/onlinedocs/QuickOpc/Latest/User%2...#Event%20Pull%20Mechanism.html . Semantically, it gets you precisely the same notifications as you would get with events or callbacks, but the coding is different and the activity to obtain the data comes from your side.
There is a Python example right on that documentation page. It looks like this:
# This example shows how to subscribe to item changes and obtain the events by pulling them.
import time
import win32com.client
# Instantiate the client object
client = win32com.client.Dispatch('OpcLabs.EasyOpc.DataAccess.EasyDAClient')
# In order to use event pull, you must set a non-zero queue capacity upfront.
client.PullItemChangedQueueCapacity = 1000
print('Subscribing item changes...')
client.SubscribeItem('', 'OPCLabs.KitServer.2', 'Simulation.Random', 1000)
print('Processing item changes for 1 minute...')
endTime = time.time() + 60
while time.time() < endTime:
eventArgs = client.PullItemChanged(2*1000)
if eventArgs is not None:
# Handle the notification event
print(eventArgs)
print('Unsubscribing item changes...')
client.UnsubscribeAllItems()
print('Finished.')
Best regards