python and COM
kyosohma at gmail.com
kyosohma at gmail.com
Fri Apr 27 16:20:15 EDT 2007
On Apr 27, 2:50 pm, Brian Blais <bbl... at bryant.edu> wrote:
> Hello,
>
> I am trying to communicate to a Reuters feed using Python, using a particular set of
> libraries called the Adfin Real Time library. I have VB code, and am trying to port
> it to python, and admit I really do not understand COM objects and being a Linux guy
> mainly, I don't use VB at all. I've had some marginal success, but am coming up
> empty when it comes to setting up callbacks.
>
> For example, this works:
>
> import win32com.client
> import time
>
> symb='GOOG.O'
>
> mylist=win32com.client.Dispatch('AdfinXRTLib.AdxRtList')
>
> mylist.Source="IDN_RDF"
> mylist.RegisterItems(symb,"ASK")
> mylist.StartUpdates(4) # Mode Image
>
> while mylist.ItemStatus(symb):
> pass
>
> for i in range(100):
> m=mylist.Value(symb,"ASK")
> print m
> time.sleep(2)
>
> but to get it to automatically updated quotes, in VB they do something like
>
> #================
> Public Class Form1
> # Dimension a Public Real Time list object that is capable of handling events
> # note from me: not sure what this line does really
> Dim WithEvents AdxList As New AdfinXRTLib.AdxRTList
>
> Public Sub AdxList_OnUpdate( <some args deleted>) Handles AdxList.OnUpdate
>
> do stuff with the updated data
>
> End Sub
>
> Private Sub Button1_Click(<some args deleted>)
>
> do stuff with button click
> End Sub
> End Class
> #================
>
> It seems as if the important part is the "Handles AdxList.OnUpdate", which I assume
> is basically saying "call me when AdxList.OnUpdate is called". I have no idea how to
> get this to point to a python function, so I can make the AdxList.OnUpdate call
> python code.
>
> Is there a tutorial somewhere about this stuff, or is there a proper place to ask
> such questions?
>
> thanks,
>
> Brian Blais
>
> --
> -----------------
>
> bbl... at bryant.edu
> http://web.bryant.edu/~bblais
I found some info on Python, VB, and COM. Check out the links below:
http://vb2py.sourceforge.net/
http://mail.python.org/pipermail/python-list/2005-July/332502.html
http://www.oreilly.com/catalog/pythonwin32/chapter/ch12.html
http://mail.python.org/pipermail/melbourne-pug/2006-April/000132.html
Not sure if those will help, but they might give you some food for
thought.
Mike
More information about the Python-list
mailing list