PythonWindowsTutorial 下载本文

Robinson Analytics

Using Python to Harness Windows

Tutorial Notes

O?Reilly Python Conference, Monterey, 21-24 August 1999

Andy Robinson, Robinson Analytics Ltd.

These notes closely follow the slides for the tutorial and include all code samples.

6795.doc

Table of Contents

Table of Contents ............................................................................................................ 2 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16

Background ........................................................................................................... 4 What is Python good for on Windows? ................................................................. 5 How Python works on Windows ............................................................................ 6 The Pythonwin IDE ............................................................................................... 9 Introduction to Python and COM ......................................................................... 16 Adding a Macro Language .................................................................................. 31 Client Side COM and Excel ................................................................................ 39 Automating Word ................................................................................................ 45 Distributing our Application with DCOM .............................................................. 52 Database Access ................................................................................................ 54 Communications ................................................................................................. 61 System Administration ........................................................................................ 63 Active Scripting ................................................................................................... 64 GUI Development ................................................................................................ 66 Delphi .................................................................................................................. 68 C and C++ Level Integration .............................................................................. 69

6795.doc

6795.doc

Part 1: - Fundamentals

Using Python To Harness Windows

1 Background

1.1 What we will cover

? How Python works on Windows ? What?s in Pythonwin

? Building applications with Python and COM ?

Getting started on common tasks ? Automating Office applications ? Connecting to databases ? Communications ?

GUI libraries

1.2 What we won’t cover

? Low-level Windows internals ? Hardcore COM - how it works ? NT Services

?

NT processes, events and threading models

Page 4 of 71

6795.doc