Conclusion
In this chapter we have learned how to build a functioning Python COM server, and a graphical client application that uses it. This approach uses each language where it’s strongest: Python excels at data manipulation and object-oriented development, whereas Visual Basic allows you to build rich, commercial-quality user interfaces. From the user’s viewpoint, there’s no way to tell she is using Python.
In addition to building the core of an application in Python, this technique offers an easy way to add a small amount of Python functionality to existing applications. For example, if you have a large VB application and want to use a specific Python tool or library, you could wrap it with a COM server and call it from VB.
We have seen examples of the various data types that can be passed back and forth between the two languages: numbers, strings, and arrays. The ability to pass multidimensional arrays allows you to move large amounts of data between the two languages without writing a lot of conversion code. The exact rules on parameter passing are covered later in Chapter 12 , but in general it all works as expected with little effort on your part.
Although we focused on VB, the client can be built in many different development tools. We’ve given an example in Delphi, and we know of people working in other environments such as PowerBuilder.
Although the application so far is technically interesting, it could have been written (with a bit more work) in VB without any of Python’s ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access