[python-win32] Python and Visual Basic Integration

Mark Norley m_norley_public at yahoo.co.uk
Wed Jul 23 19:45:28 CEST 2008


Thanks Tim. Where would I go to find out about setting up my Python script
as a COM server? (A "for dummies" level of instruction is what I'd be
looking for :-)


On Wed, Jul 23, 2008 at 7:28 PM, Tim Roberts <timr at probo.com> wrote:

> Mark Norley wrote:
>
>>
>> I've got a Python script that outputs a large text file of data and I've
>> recently made a simple GUI for it in Visual Basic (2008). While it's simple
>> enough to launch the Python script and pass it command line parameters from
>> VB using Shell(python etc), I'm wondering how to pass information back to VB
>> from Python. For example, it would be nice to be able to let VB know that
>> the Python script has finished (at the moment I am repeatedly checking for
>> the existence of the aforementioned text file, and sleeping for a short
>> while if it hasn't appeared, which is clumsy but works).
>>
>> Ideally, I would like to be able to pass parameters to Python functions
>> from VB and return values back to VB, just using VB for the front end while
>> Python does all the hard work. I know I could just use Tkinter but is this
>> sort of integration between Python and VB possible?
>>
>
> Yes, with some glue.  You can turn your Python script into a COM server,
> and then use the .NET COM Interop to invoke it from your VB code.
>
> Is that more trouble than starting a process and monitoring its results?
>  You'll have to judge that yourself...
>
> --
> Tim Roberts, timr at probo.com
> Providenza & Boekelheide, Inc.
>
> _______________________________________________
> python-win32 mailing list
> python-win32 at python.org
> http://mail.python.org/mailman/listinfo/python-win32
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-win32/attachments/20080723/e97ab17f/attachment.htm>


More information about the python-win32 mailing list